Author Posts

March 25, 2016 at 8:09 am

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.

March 25, 2016 at 9:16 am

You certainly can do that and I would suggest you start by reading the secrets of powershell remoting. https://www.penflip.com/powershellorg/secrets-of-powershell-remoting

March 30, 2016 at 1:43 pm

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 "10.8.50.196" -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 "10.8.50.189" -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.

Thanks!