Remotely running a PS script in the logged on users context

BatchPatch Forums Home Forums BatchPatch Support Forum Remotely running a PS script in the logged on users context

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8835
    SBruening
    Participant

    Hello,

    I want to run a PS script with the following command

    ([wmiclass]”Win32_Printer”).AddPrinterConnection(“\PRINTSERVERirc5535”)

    to connect a printer. For the printer to be usable, this needs to be run in the logged on users context.

    Running the command using the PSEXEC “-i” option does not seem to do the trick.

    Can anyone help me please?

    #10109
    doug
    Moderator

    I think you would have to execute the action with the desired account (the account logged on to the target computer) being used as the ‘Alternate Credentials’ account in BatchPatch or actually launch BatchPatch.exe with that account. Then under ‘Tools > Settings > Remote execution’ specify ‘Elevated token’ instead of ‘SYSTEM’. Then try your command. I can’t guarantee that this will work to do what you want, but it might.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.