How does this vbscript start

This is the beginning of our network printer push vbs script. The script is located in a scripts folder called scripts off the root of the c drive. There is also a copy in the netlogon folder. I would like to know how this script is executed? I don't see anything in the AD group policy nor the local windows 2008 server group policy under scripts or login. Does simply placing the vbs script on the server execute the script? Or is there an application I'm unaware off that I need to look for that executes MapPrint.vbs scripts.

Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objNet = CreateObject("WScript.NetWork")
set objUser = GetObject("WinNT://" & objNet.UserDomain & "/" & objNet.UserName)

objShell.LogEvent 0, "User " + objNet.UserName + " Has logged on."

Rem  **** Check if User is in an AD Group

August 2nd, 2013 11:41am

The script does nothing important.  It is an attempt to log a user when they log on.  It attempts to place an event in the event log.  This is silly as the user is already logged in the event log by the time this script would execute.  You can safely remove it assuming no other processes are using the log entries.

This script has nothing to do with printers.  It is even likely that it is not being used.

If you need to track this down  either work with your network admin or look into hiring a consultant.

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2013 11:50am

That was not the entire script I stated this is the beginning of the printer script. More of the script reads

for each oGroup in objUser.Groups
    If oGroup.Name = "MI CSR" Then
       Rem *** User is member of group, map printer
       objShell.LogEvent 0, "User " + objNet.UserName + " is a member of group " + oGroup.name
       objNet.AddWindowsPrinterConnection "\\MMIXENCENTRAL\LP05"
       objNet.AddWindowsPrinterConnection "\\MMIXENCENTRAL\LP06"
       objNet.AddWindowsPrinterConnection "\\MMIXENCENTRAL\LP23"
       objNet.AddWindowsPrinterConnection "\\MMIXENCENTRAL\LP26"

August 2nd, 2013 12:13pm

Is it actually running when users log in?
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2013 12:16pm

Yes If your in the AD group specified at the beginning of the script those network printers will map every time you log in.
August 2nd, 2013 12:28pm

Then the script is set to run automatically somehow. Usually this is because there is a logon script specified in a GPO or a logon script is specified for the user's profile.

Bill

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2013 12:31pm

I've looked everywhere, I was told that simply placing the vbs script on the server in a folder off the root of C causes the script to run. If that is not true is there an application or command line interface command I can use to find out how this script runs.
August 2nd, 2013 3:55pm

I think you need to get in touch with your helpdesk or IT department. Something is in place, but there's no way we'll be able to tell you how your systems are configured.
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2013 4:04pm

I was told that simply placing the vbs script on the server in a folder off the root of C causes the script to run.

Either someone is playing a joke on you, or there is some unknown* mechanism that is starting the script automatically. You will need to consult with your system administrator(s) to find out how this is happening.

(* "unknown" in this context means "there is no way for us to know what's happening because we don't have access to your network and we cannot see your screen.")

Bill

August 2nd, 2013 4:07pm

This will give you a list of all candidate scripts in the domain:

dir mydomain.com\*.vbs /s

You will see a list of all folders with a vbs script.  Inspect the scripts:

type <path>\scritpname.vbs

The path will be the GUID of the GP object that can run the script.

If the GP points at the netlogon share then it will be harder to find so run RSOP on an account that uses the script.  It will show you which GP is running the script.

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2013 5:05pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics