Recommended Posts

So our old login script has been failing quite often so it was my job to make a new one and get it working optimally. For the last 2 weeks I've had 5 people in our office running the test script. And while I haven't been getting any errors I've been noticing some delays in the script actually launching.

On the server I enabled \Computer Configuration\Administrative Templates\System\Logon- Run Login Scripts Synchronously. But that only created problems with the computer hanging or taking extremely long time for the OS to load.

So I then tried \Computer Configuration\Administrative Templates\System\Logon\Always wait for the network at computer startup / shutdown and that really didn't workl.

I currently have the Group Management Policy Console doing the handling of the script. Would it work more efficiently if I just went into Active Director and specified the logon script there?

During the week every time they log in it works. But after the weekend is over, where we haven't logged in for a while, the script either fails to execute or take a few minutes then will execute.

Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/
Share on other sites

Attaches 3 network drives and 9 printers.

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, shell
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strUserName
Dim strDrive, objshell, objunc, strLoggedOnUser, strNewName1, strNewName2, strNewName3

strDriveLetter1 = "R:"
strDriveLetter2 = "S:"
strDriveLetter3 = "T:"
strRemotePath1 = "\\rdaserver\rda files"
strRemotePath2 = "\\rdaserver\base files"
strRemotePath3 = "\\rdaserver"
strNewName1 = "RDA Shared Files"
StrNewName2 = "RDA Base Files"

Set objNetwork = CreateObject("WScript.Network")

' Section which maps the drives
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2

strUserName = objNetwork.UserName

objnetwork.MapnetworkDrive strDriveLetter3, strRemotePath3 & "\" & strUserName

strNewName3 = strUserName & "'s Personal Folder"

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1
objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2
objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3

set shell=createobject("wscript.shell")
shell.run "logon.bat"
set shell=nothing

objNetwork.AddWindowsPrinterConnection "\\RDAServer\Cottonwood"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Maple"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Pine"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Rainbow"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Starburst"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Redwood"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Oak"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Sequoia"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Skittles"

Wscript.Quit

The code itself is very efficient and I've never gotten errors. It just seems that login is not authenticating automatically and pulling the GOP right away.

Edited by Unholee
Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/#findComment-589232023
Share on other sites

The default update interval for Group Policy on the Domain controllers is 5 minutes.

The default update interval for User Group Policy is 90 minutes with a random offset of 30 minutes.

The default update interval for Computer Group Policy is 90 minutes with a random offset of 30 minutes.

Unless you do a gpupdate /force

And I've had good success with using it as a users logon script in gpo

Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/#findComment-589248953
Share on other sites

  • 1 month later...

The first thing I would do is split your printers part into their own vbs.

Printer drivers can be very tempremental and if the install of a driver has a error the script will die.

Also you can check to see if the mapped drive already exists before mapping it.

I dont have my scripts to hand, they have error logging as well built in to track problems.

I will upload on monday.

Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/#findComment-589315756
Share on other sites

  ZeroHour said:
The first thing I would do is split your printers part into their own vbs.

Printer drivers can be very tempremental and if the install of a driver has a error the script will die.

Also you can check to see if the mapped drive already exists before mapping it.

I dont have my scripts to hand, they have error logging as well built in to track problems.

I will upload on monday.

if you're running Ad (Active Directory) it's best to load the login script into the AD-groups & users logon.bat;i have setup several AD networks which require automatic mapping of network drives, ras servers and the sort, and found it works best when the AD-user logon.bat executes the command.

and if i'm not mistaken, anytime you load code into group policy ect, it has to reload it into the network startup load. which takes awhile.

Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/#findComment-589319191
Share on other sites

Well I've pretty much figured out the problem of what happened.

The IT guy before me set up the AD with a Windows 2000 AD with cached log in. All the desktop computers recognized the script on startup but the laptops were having an issue. I tweaked some settings and right now I'm having a 100% success.

Instead of having the GPMC handle the script, I've just gone to their profile in dsa.msc and having the .vbs script run there. That's what I've changed.

Zerohour I'm pretty new at .vbs scripting but I changed the script to have this end if statement (so far it's worked just fine)

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, shell
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strUserName
Dim strDrive, objshell, objunc, strLoggedOnUser, strNewName1, strNewName2, strNewName3
Dim objDrive, objFSO

On Error Resume Next
If objFSO.DriveExists(strDrive) = False Then

strDriveLetter1 = "R:"
strDriveLetter2 = "S:"
strDriveLetter3 = "T:"
strRemotePath1 = "\\rdaserver\rda files"
strRemotePath2 = "\\rdaserver\base files"
strRemotePath3 = "\\rdaserver"
strNewName1 = "RDA Shared Files"
StrNewName2 = "RDA Base Files"

Set objNetwork = CreateObject("WScript.Network")

' Section which maps the drives
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2

strUserName = objNetwork.UserName

objnetwork.MapnetworkDrive strDriveLetter3, strRemotePath3 & "\" & strUserName

strNewName3 = strUserName & "'s Personal Folder"

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1
objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2
objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3

set shell=createobject("wscript.shell")
shell.run "logon.bat"
set shell=nothing

objNetwork.AddWindowsPrinterConnection "\\RDAServer\Cottonwood"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Maple"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Pine"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Rainbow"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Starburst"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Redwood"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Oak"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Sequoia"
objNetwork.AddWindowsPrinterConnection "\\RDAServer\Skittles"

Wscript.Quit
end if

Would you recommend I just set up another end if statement on a new printers script?

P.S I've never had a problem with the printers loading in the script.

Link to comment
https://www.neowin.net/forum/topic/622055-logon-script/#findComment-589324081
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Bethesda's Deathloop is free to claim on the Epic Games Store this week by Pulasthi Ariyasinghe The Epic Games Store's Mega Sale promotion is in its final week, and that means mystery giveaways are soon ending too. For the finale, Epic Games has called in something big from Bethesda, with the Arkane-developed time loop adventure Deathloop coming in as the latest freebie for PC gamers. Alongside it, the indie adventure Ogu and the Secret Forest is also free. Developed by Arkane Lyon and published by Bethesda, Deathloop comes in touting an action-packed campaign involving plenty of time travel shenanigans. The game is set on the mysterious island of Blackreef, where two rival assassins, Colt and Julianna, are trapped in a time loop. The player, as Colt, has to figure out how to eliminate eight targets within a single day to escape the loop. Each of the assassinations can be taken care of in many ways, including stealth, traps, accidents, or simply going in guns blazing. Aside from gunplay, the title also makes use of supernatural systems very similar to the studio's Dishonored franchise, letting players teleport, go invisible, use telekinesis, and more. There is a multiplayer twist here too, where players, as Julianna, can invade the campaigns of others to take the role of the rival assassin, flipping the tables on the main character and his plans. As for Ogu and the Secret Forest, this is a 2024-released indie adventure featuring hand-drawn characters and various types of puzzles. The 2D game involves befriending characters across a fantasy land as baby Ogu, with plenty of exploration, puzzle solving, and boss battles available. The Deathloop and Ogu and the Secret Forest giveaways are now live on the Epic Games Store for all PC gamers. The promotion is slated to last until June 12, giving you seven days to claim a copy for your library permanently. While the summer mystery giveaways are ending, regular freebies will continue to arrive from the Epic Games Store. When this one comes to an end on Thursday, the SEGA-published humorous hospital simulation entry Two Point Hospital is incoming as the next giveaway.
    • If graphics is all that matters to you go watch a Pixar movie or something, you sound like an absolute baby right now. The game looks great.
    • For sure!! My take is... If the dev choses to use Apple's payment services, sure, Apple can take a cut. Apple disallowing 3rd party payment processing directly within an app, kind of a gray area, its anti-competitive sure, but I can at least see arguments on both sides. Apple blocking or attempting to take a cut from weblinks is pure evil, there is no possible justification at all. Heck, if we take this to the logical next step, Apple should start demanding a cut of retail transactions if the user used GPS directions on an iPhone to get to the store.
  • Recent Achievements

    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      407
    2. 2
      +FloatingFatMan
      181
    3. 3
      snowy owl
      176
    4. 4
      ATLien_0
      170
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!