I've been working on a small, redeployable .ps1 script that will be used to automate the clearing of the end user's print spooler and clearing of the printing queue, with more features in future implementation. Here's a snippet of some of the commands that require elevation.
In order to successfully run this script on end user's computers, I've created a Powershell credential object like so. (It doesn't matter if the administrator credentials are in clear text, since it is executed in the background over RMM).
However, when I try to run any command with the newly made variable like this,
I get some sort of complication, such as the PS window only returning the syntax of the command instead of actually running it. I'm relatively inexperienced in the Powershell automation; If someone could offer up a solution as to how to best integrate the newly made credential object into my script so that it will run with elevated permissions in its entirety, It'd be much appreciated. Thanks!!! |
↧
How can I successfully run my remote script with administrator permissions?
↧