Script beginer

Welcome Forums General PowerShell Q&A Script beginer

Viewing 1 reply thread
  • Author
    • #201450
      Topics: 1
      Replies: 0
      Points: 13
      Rank: Member

      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.



      pairdisplay -IM100 -g $server -fcx
      start-sleep -s 2

    • #201462
      Topics: 12
      Replies: 1488
      Points: 1,982
      Helping Hand
      Rank: Community Hero

      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.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.