I need to install a printer by calling a cmd file from a location.
The script that I have now is
# To take screenshot
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
The above script isnt working. Can someone please help?
And it won't, that is by design.
To take a screen shot you have to be logged on the system as an interactive user.
This is not possible with PoSH as PoSH provided no way for you to logon to a remote computer, like you'd do with RDP or other remote viewer tools. It's a Windows security boundary, only one person can be logged on interactively at a time. PoSH will not allow you to violate this specification.
If you need to logon to a remote system in the context of another user that that is what MS SysInternals 'psexec', or tools like AuotIT are for.
Think about the implications of what you are asking here. Being able to remote view a system without the users direct consent.
Why the need to take a screen shot, when you can user WMI/CIM to pull these settings?
If you are an admin on the remote host, you can pull any information you choose, well, as long as PSRemoting is enabled and settings are properly applied. Yet, again, no, screen shooting, is not a thing in what you are after, nor should it be.
Use PoSH to remote install printers (there is plenty of sample code on the web to show how to do that, powershellgallery.com, the MS scriptingguys blog, etc.), then use PoSH remoting to pull other setting information after the install (again, lot's of sample code on the web showing how to do this).
This is a local printer ans I would need a screenshot of the installed printers in the control panel list.
You must be logged in to reply to this topic.