Dear, Team
want to using the powershell script to using os version check multiple nodes in the WEST group
see the following script plz
===================================================================
if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {
Add-PSSnapin "SwisSnapin"
}
#Prep File
$File = "C:\OS_CHECK.txt"
$hostname = "127.0.0.1"
$username = "admin"
$password = New-Object System.Security.SecureString
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$swis = Connect-Swis -v2 -host $hostname -cred $cred
$group= 'WEST'
$nodeId = get-swisdata $swis "SELECT NodeID FROM Cirrus.Nodes WHERE NodeGroup='$group'"
$script ="sh run"
#how can i change below lines to apply to multiple nodes ???
$nodeIdList = New-Object -TypeName "System.Guid[]" 1
$nodeIdList[0] = $nodeId
Invoke-SwisVerb $swis Cirrus.ConfigArchive Execute @($nodeIdList, $script, $username) | Out-Null
$transferID = "{$nodeId}:${username}:ExecuteScript"
do {
Start-Sleep -Seconds 1
$status = Get-SwisData $swis "SELECT T.Status, T.Error FROM Cirrus.TransferQueue T WHERE T.TransferID=@transfer" @{transfer=$transferID}
#Write-Host $status.Status
}
while (($status.Status -ne 'Complete') -and (-not $status.Error))
$output = Get-SwisData $swis "SELECT T.Log FROM Cirrus.TransferQueue T WHERE T.TransferID=@transfer" @{transfer=$transferID}
write-host $output
$output | Out-File $File
Write-Host "Process Completed!!"