Link to home
Start Free TrialLog in
Avatar of llarava
llaravaFlag for Afghanistan

asked on

Help with a VBS printer check and program execution

Hi,

Can someone help us out with the following scenario:

-Our printers to are configured via GPO/Preferences
-Some users have an application that needs the printer to  mapped in order to work launch correctly. There is a little delay for the GPO to finish mapping the printer and the program sometimes starts before the default printer is mapped.  

I was wondering how hard would be to have a script that will call the app .exe as soon as the printer is available to the computer via group policy.
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of llarava

ASKER

Rob,

Thank you very much! Would it be possible for the script to loop one time in case during the 30 seconds the printer has not been mapped? For example the script runs after 30 seconds then it runs again and tries to find the printer if it's not then will do nothing.  I understand we could extend the time to 60, however if the printer is ready sooner then we should be able to get the app launched much quicker.

Thanks!
Hi, the script is retrying every second, up to intTimeout seconds. Within the loop, it queries the printer objects, and if a default network one is found, it exits the loop, otherwise it waits one second, and checks again.

It should work the way you want it to, but if not, I'll do more testing.

Rob,
Avatar of llarava

ASKER

Excellent! Thank you!