Jump to content
Sign in to follow this  

Problem with printer mapping

Recommended Posts


Hello, I'm trying to run this script for printer mapping but the only way I succedded to do it is with sleep function.

The problem is that when I close the printer window (the function) the script is still being executed and does not terminate.

Need help replacing the sleep with another function maybe.

Thanks in advance!

$objSysInfo = ObjCreate("ADSystemInfo")
$SiteName = $objSysInfo.SiteName
$SiteName = StringReplace($SiteName,"-","/")
If StringRight($SiteName, 1) <> "/" Then $SiteName = $SiteName & "/"

 $oWSHell = ObjCreate("Shell.application")
$oWSHell.FindPrinter ("",$SiteName,"")
Sleep (100000000)
 $oWSHell = ""

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.