Jump to content

Recommended Posts

Posted

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 & "/"
 $objSysInfo=""

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

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