I'm a little new to the SDK, and with the new Shutdown and Enable buttons in the web console of UDT, I was trying to us PoSH to shut down an interface.
The meat and potatoes of the script looks like this:
$nodeid = 137
$port = 1169
Invoke-SwisVerb $swis Orion.UDT.Port AdministrativeShutdown @("N:$node","UP:$port")
Is it possible to use the SDK for this action? How far off am I?
I've tried a couple methods that seem like they should work, but I'm stuck at this... This is the error I'm getting now:
Invoke-SwisVerb : Verb Orion.UDT.Port.AdministrativeShutdown: Cannot find assembly
At C:\Users\alagrone\Desktop\Basic AdShut.ps1:15 char:16
+ Invoke-SwisVerb <<<< $swis Orion.UDT.Port AdministrativeShutdown @("N:$node","UP:$port")
+ CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
+ FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb
or, with this modification:
if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {
Add-PSSnapin "SwisSnapin"
}
#Connect to Swis
#$hostname = "localhost"
#$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$swis = Connect-Swis -v2 -Trusted #-Hostname 'localhost'
#$nodeid = 137
$portids = 1169
#Get-SwisData $swis "SELECT NodeID FROM Orion.UDT.Port WHERE PortID=@portids" @{portids=$portids}
#Get-SwisData $swis "SELECT PortID FROM Orion.UDT.Port WHERE PortID=@portids" @{portids=$portids}
$node= Get-SwisData $swis "SELECT NodeID FROM Orion.UDT.Port WHERE PortID=@portids" @{portids=$portids}
$port= Get-SwisData $swis "SELECT PortID FROM Orion.UDT.Port WHERE PortID=@portids" @{portids=$portids}
Invoke-SwisVerb $swis Orion.UDT.Port AdministrativeShutdown @("$node","$port")
I get:
Invoke-SwisVerb : Verb Orion.UDT.Port.AdministrativeShutdown cannot unpackage parameter 1
At C:\Users\alagrone\Desktop\Basic COnnect.ps1:18 char:16
+ Invoke-SwisVerb <<<< $swis Orion.UDT.Port AdministrativeShutdown @("$node","$port")
+ CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
+ FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb