Jump to content

Hit a brick wall with this script...


Recommended Posts

Posted

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?

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...