I am new to scripting all together and am trying to figure out how I can cycle through this variable so that the command can use the same variable to work. Any assistance would be appreciated.
$server=‘dc2pa90048,tocpaIIB-TI,lsys7011a-TI’
pairdisplay -IM100 -g $server -fcx
start-sleep -s 2
There are some great books for beginners, especially if you have no scripting experience.
Powershell is full of help files and there a ton of free videos, blogs, etc. available. The short answer is you need to look at arrays and foreach loop. Another important item is operators, specifically call operators to call external non-Powershell commands.
$servers =' dc2pa90048','tocpaIIB-TI','lsys7011a-TI'
foreach ($server in $servers) {
& pairdisplay -IM100 -g $server -fcx
start-sleep -s 2
}
Please also re-read Read Me Before Posting! You’ll be Glad You Did! and ensure you use the PRE tags for your code.