Remotely Execute PowerShell on many Windows 7 machines simultaneously

This topic contains 3 replies, has 3 voices, and was last updated by  Anthony Stringer 2 years, 3 months ago.

  • Author
  • #36971

    Kyle Wilcox

    Hi all,

    I am pretty new to PowerShell and just wondering what it can enable for me. I am hoping that will the proper remoting/session setup, I can sit in my office and run powershell code across all the teacher computers in my school at the same time. The first use case would be to install printers (by calling vb scripts), but it could be anything.

  • #36973

    Jonathan Warnken

    You certainly can do that and I would suggest you start by reading the secrets of powershell remoting.

  • #37116

    Kyle Wilcox

    Thanks for the recommendation! I read the whole book. I would love to continue this discussion, specifically in regards to printing. Our domain is not set up yet so it's hard to test remoting.

    Basically I am planning two scripts. One uses copy-item to copy drivers from a file share to the local c drive.

    The next calls on some vbscript to install the printer and looks like this:

    # Lines that start with # in PowerShell are comments for humans only. The computer ignores them.

    # The dollar sign ($) is used for variables in PowerShell. We might add variables latter; it gets kind of tricky.

    # The first line creates a printer port.
    # The second line installs the print driver.
    # The third line installs the new printer.

    # C163 Computer Lab Printer

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-us\PRnport.vbs" -a -r "IP_10.8.50.196" -h "" -o raw -n 9100

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-us\PRndrvr.vbs" -a -m "HP Universal Printing PCL 6" -h "C:\software\drivers\HPupdx64" -i "C:\software\drivers\HPupdx64\hpcu175u.inf"

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs" -a -p "C163 Computer Lab Printer" -m "HP Universal Printing PCL 6" -r "IP_10.8.50.196"

    # Teacher Workroom Xerox 4112

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-us\PRnport.vbs" -a -r "IP_10.8.50.189" -h "" -o raw -n 9100

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-us\PRndrvr.vbs" -a -m "Xerox 4112 PCL 6" -h "C:\software\drivers\Xerox4112x64" -i "C:\software\drivers\Xerox4112x64\xr6fmie.inf"

    cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs" -a -p "Teacher Workroom Xerox 4112" -m "Xerox 4112 PCL 6" -r "IP_10.8.50.189"

    As you can imagine I am going to be writing a lot of scripts!

    Any help comments or discussion is appreciated. I am worried about permissions when running these under remoting. The printers must be installed by a local admin and the copy-item command must have permissions to see the file share.


  • #37119

    Anthony Stringer

You must be logged in to reply to this topic.