ss3vegeta Posted September 6, 2012 Posted September 6, 2012 Hi, I am simply trying to write a script to help deploy printers and I have run into a bit of a snag. I cannot get the cmd window to open with the proper elevation to run commands like: pnputil -i -a c:\print_drivers\driverstore\hp001a\prnhp001.inf I can run this command manually from an elevated command line prompt without issue, however it will not work using: #RequireAdmin and/or RunAsWait($adminAcct, @ComputerName, $adminPass, 0, @ComSpec & " /k pnputil -i -a c:\print_drivers\driverstore\hp001a\prnhp001.inf") I get an error that says: "Adding the driver packaged failed : Access is denied." Any advice would be greatly appreciated.
ss3vegeta Posted September 6, 2012 Author Posted September 6, 2012 Forgot to say win7 64 ultimate, not sure that matters.
AntiVirusGuy Posted September 6, 2012 Posted September 6, 2012 put a sleep in your process to verify it is running as the user you think you are it may be an issue with the credentials you may also use the /f force pnputil
ss3vegeta Posted September 6, 2012 Author Posted September 6, 2012 put a sleep in your process to verify it is running as the user you think you are it may be an issue with the credentials you may also use the /f force pnputilHow would I put a pause in the process to check? It pops up and leaves very quickly. Do you mean to use -f with pnputil? I think force can only be used to delete from the driver store.
ss3vegeta Posted September 6, 2012 Author Posted September 6, 2012 I figured it out, the problem was that I was using the wrong flag. I needed to use 2 instead of 0. RunAsWait($adminAcct, @ComputerName, $adminPass, 2, @ComSpec & " /k pnputil -i -a c:print_driversdriverstorehp001aprnhp001.inf")
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