Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript login script

Status
Not open for further replies.

clair

MIS
Mar 24, 2001
59
US
Hello everybody,
I have a .bat logon script. It has several rutines, one of which calls a vbscript that supposed to set up an Internet Explorer proxy. This vbscript runs, but doesn't set up proxy.
But when I ran it afterwords - through the same login script, or by itself (from the same netlogon share), it works.
I can't figure out why it's happening and how I can fix it.

Thank you,

Claire
 
faq329-5798

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Can you not do it through GPO
Group Policy -> User Configuration -> Windows Settings ->
Internet Explorer Maintenance -> Connection -> Proxy Settings
 
Hi all,
Thank you for replying.
Unfortunately I can't set up proxy through the GPO, because the proxy depends on the subnet. The script checks what subnet your computer is on, checks the table of subnets and proxies, and changes the registry to set up a proxy specific for your subnet (well, we have many subnets and just several proxies, but still...).
And we start this script from our login script (cscript //B //NOLOGO %LOGONSERVER%\netlogon\Sriptdirectory\proxy_PAC.vbs).

Any ideas why it's not really run from logon script, but there's no problem to run it afterwords? Thank you,

Claire
 
have a look at my other FAQ which shows how to deal with subnets using scripts in GPO.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Sorry forgot to post the link.
faq329-5908

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hello and thank you for your replies. My problem is not that I need a new script - this vbscript works just fine when run after computer starts and logon script has finished. The problem is that for some reasoin it doesn't run when a login script executes at the computer start up time. I need to find out why and fix that problem. Any ideas are much appreciated.

Claire
 
Login scripts do NOT run at computer startup. Those are StartUp scripts which are found in the GPO under Computer settings, not User Settings.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I'm sorry I didn't frase it correctly. Logon script runs when a person logs in. And at that time our vbscript, which is called from a login script, doesn't run for some reason. But later, when we manually re-run logon script (from its location on a DC) our vbscript called by a logon script runs just fine. I'm trying to find out what it is preventing the vbscript to run at the logon time. Thank you again,

Claire
 
Clair, I would avoid the use of the older BAT files and simply combine this all into one script or deploy them both using GPO.

Read the instructions for implementing a script in the first FAQ I linked to. It details checking the rights to ensure you have "Apply Policy" to the intended audiance.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Have you tried to add quotes ("") around the command line options?

cscript //B //NOLOGO "%LOGONSERVER%\netlogon\Sriptdirectory\proxy_PAC.vbs"

another option would be to see if running it from the SYSVOL makes any difference. For reasons I haven't figured out yet I have had the location of the script changes whether or not it runs.

cscript //B //NOLOGO "\\[YourDomainName]\SYSVOL\[DNS Name of Domain]\scripts\Sriptdirectory\proxy_PAC.vbs"
(or something like that)



Thanks

John Fuhrman
Titan Global Services
 
A suggestion and question re: markdmac's excellent login script:

First, thanks! The script is great - really helpful.

The delete printers section didn't work for me. We had TCP/IP printers set as local printer ports, and the script would fail. I replaced that section with the following from The Scripting Guys:

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Network = FALSE")

For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next

My big question: The section on adding printers. When I run the line
objNetwork.AddWindowsPrinterConnection "\\filesrvr\LibraryEast"
it fails, with an error 13. The printer actually seems to be added (and I think it works), but the error bothers me (and my error checking routine). Any idea what's going on here?

Thank you all!
Jerry Kearns
 
Need more info on the error. Check the event logs.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
There is nothing in the event viewer. If I run the debugger or MS Script Editor, err.Number becomes 13 as soon as the line
objNetwork.AddWindowsPrinterConnection "\\filesrvr\LibraryEast"

is run.

:(

Jerry
 
Verify that the printer share is as you typed and verify if the printer already exists.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Also, use error trapping to get a description of the problem.

If Err.Number <> 0 Then
Wscript.Echo "Error Encountered:" & Err.Number & " " & Err.Description
End If[/code]

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Found it! My previous line was missing a "'" character, as in:
Case "LI" Library
objNetwork.AddWindowsPrinterConnection "\\dc2\LibraryEast"

Thanks!
 
Deleting Printers Problem:

I can't figure a way to get this script to delete the "Microsoft Office Document Imaging Printer", or the XPS printer. These seem to need Admin rights to delete.

Anyone have a suggestion?

Thanks!
Jerry
 
If your script is executing from a GPO it should have the needed rights. How are you testing?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I haven't made it a GPO, but it is a VBScript set as their Logon Script in AD Users and Computers, so it automatically runs when they log in. Also, trying manually once logged in, Domain Users cannot delete the printer, only Admins.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top