mrbios Posted December 11, 2017 Posted December 11, 2017 net stop spooler rename-item -Path "HKLM:\System\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\winprint" -NewName "WinPrint.old" net start spooler cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -x cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs -d -m "EPSON Universal Print Driver" -v 3 -e "Windows x64" net stop spooler rename-item -Path "HKLM:\System\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\winprint.old" -NewName "WinPrint" net start spooler cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs -a -m "EPSON Universal Print Driver" -v 3 -e "Windows x64" -i "\\printserv\Printer Drivers\Epson Universal Driver 2.68.1\E_JFB0DE.INF" h "\\printserv\Printer Drivers\Epson Universal Driver 2.68.1" The issue, and reason for this script, is a broken newer version of a print driver that i need to remove and replace with an older version. This isn't happening automatically, and the reason for the reg keys and spooler stop/start is the driver getting stuck in a "Driver is in use" state. I've tested this script manually, and it works when run as elevated admin. However i need to run this as a logon script and at the moment the "Rename-Item" components give me this error: "Requested registry access is not allowed" I've tried changing all the permissions and ownership of the specific key I want to rename, but nothing appears to work. How can i elevate this script to run as administrator on logon? Is that even possible?
snagrat Posted December 11, 2017 Posted December 11, 2017 Can it not be a startup script, rather than login script? Would then run as admin rather than user
mrbios Posted December 11, 2017 Author Posted December 11, 2017 Tried it as both, doesn't appear to work as a startup script. Only seems to run correctly as a domain admin when set as a logon script on the occasions when the driver doesn't come up as in use.
LeMarchand Posted December 11, 2017 Posted December 11, 2017 Have you tried it as a scheduled task using the SYSTEM account?
RobD Posted December 11, 2017 Posted December 11, 2017 What if you pushed it via PDQ deploy or similar?
bald_pig Posted December 11, 2017 Posted December 11, 2017 What about this? https://stackoverflow.com/questions/14639743/batch-script-to-run-as-administrator/35219328#35219328
angrycomputingteacher Posted December 11, 2017 Posted December 11, 2017 Like @LeMarchand said, Try scheduling a task that runs the script through GPO Preferences.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now