Jump to content

Recommended Posts

Posted

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.

Posted

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

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

Posted

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")

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...