when I run this script p2.vbs (located on c: - I just double click it) the printer changes default just fine....so I know the script works......however when I do it with KACE- nothing happens!

dependencies:

p2.vbs

Verify

1.Launch a program...

Directory:$(KACE_SYS_DIR)

File:cscript.exe

Parameters:$(KACE_DEPENDENCY_DIR)\p2.vbs

 

heres the script.....

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery _

    ("Select * from Win32_Printer Where PortName = 'IP_10.100.2.3' or 

 

PortName = '10.100.2.3'")

For Each objPrinter in colInstalledPrinters

    objPrinter.SetDefaultPrinter()

Next

 

This is killing me?? Anybody know what I'm doing wrong????

 

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

3

Are you leaving it as default "LOCAL SYSTEM"? Try changing it to "run as user logged in to the console".

Answered 06/18/2012 by: dugullett
Red Belt

  • That would be my guess too. You can try running it as LocalSystem through PSexec to test as well: http://www.kace.com/support/resources/kb/article/How-to-mimic-running-a-script-as-Local-System-User-Scripting?action=artikel&cat=5&id=731&artlang=en
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share