Quantcast
Viewing all articles
Browse latest Browse all 21097

Re: how can make script working for multiple nodes.

I solved this program :-)

thank you tdanner.

reference below plz

==============================================

if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {

    Add-PSSnapin "SwisSnapin"

}

 

 

$date=Get-Date -format "yyMMddhh"

 

 

$File = "C:\$date-OS_CHECK.txt"

#write-host $File

#break

 

 

 

 

$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=read-host "Input Localtion"

$IOS=read-host "Input IOS Version"

 

 

$nodeId = get-swisdata $swis "SELECT NodeID FROM Cirrus.Nodes WHERE NodeGroup='$group'"

 

 

$count = 0

foreach ($node in $nodeId) {

 

 

  $Caption = get-swisdata $swis "SELECT NodeCaption FROM Cirrus.Nodes WHERE NodeId='$node'"

  $IOS_Ver = get-swisdata $swis "SELECT OSVersion FROM Cirrus.Nodes WHERE NodeId='$node'"

 

 

  If ($IOS_Ver -match $IOS)

  {

 

 

   $output = "$Caption $IOS_Ver OK"

   write-host $output

     $output | Out-File $File -append

  }

  Else

  {

  $output = "$Caption $IOS_Ver FAIL"

         write-host $output

    $output | Out-File $File -append

  }

        $count = $count + 1

 

 

}

$count = "Total : $count Devices"

$count | Out-File $File -append

Write-Host "$count Completed."


Viewing all articles
Browse latest Browse all 21097

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>