We are trying to utilize Powershell to be able to update multiple custom properties of a specific subnet of machines. We have used the guidance found on the Github regarding most of the syntax, but we are still getting an error message when we run the entire sequence.
Here is the body of the script; I have redacted some things for obvious reasons:
#Intialization
Add-PSSNapin SwisSnapin
# Connect to SWIS
$hostname = "xxx.xxx.xxx.xxx"
$username = "UserName"
$password = get-content C:\Path\To\PWinfo.txt | convertto-securestring
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$swis = Connect-Swis -host $hostname -cred $cred
$NodeID="SELECT NodeID FROM Orion.Nodes WHERE IP_Address LIKE 'xxx.xxx.xxx.%'" # NodeID of a node which custom properties you want to change
# prepare a custom property value
$customProps = @{
Comments="TEST comment - Delete Me";
SecondarySiteEmail="test.email@testemail.com"
ESN="TEST - numbers"
}
# build the node URI
$uri = "swis://localhost/Orion/Orion.Nodes/NodeID=$nodeId/CustomProperties";
# set the custom property
$NodeID2="SELECT NodeID FROM Orion.Nodes WHERE IP_Address LIKE '10.98.108.%'" | Set-SwisObject $swis -Uri $uri -Properties $customProps
However, the error message we are getting is this: "The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input."
We were under the assumption that piping this was necessary, but we are re-thinking this. Any suggestions on what we are missing here?