I'm dumb with scripting....

Clockworks

Supreme [H]ardness
Joined
Aug 23, 2004
Messages
5,269
I'm trying to create a number of mapped drives for our company's users. Being a total newbie to this, I decided to keep it as simple as possible with a batch file. Here's the code:
Code:
@echo off
net use H: /delete
MD \\ruffles\rnfile\Users\%USERNAME%
net use H: \\ruffles\rnfile\Users\%USERNAME%

net use I: /delete
net use I: \\ruffles\rnfile\Working 

net use J: /delete
net use J: \\ruffles\rnfile\Reference

net use K: /delete
net use K: \\ruffles\rnfile\Music

net use L: /delete
net use L: \\ruffles\rnfile\Software 

net use M: /delete
net use M: \\ruffles\rnfile

net use N: /delete

net use O: /delete

When users log into their machines, it takes 10 minutes from password input to getting a desktop (only a black screen in the middle). When I log into their machines, I get it right away. This seems to only be happening in our Windows 7 machines. Event log produces this error:
The winlogon notification subscriber <GPClient> is taking a long time to handle notification even (startshell). - Error 6005

The winlogon notification subscriber <GPClient> was unavailable to handle a notification event. - Error 6006

Booting into safe mode works though....
 
Last edited:
MD \\ruffles\rnfile\Users\%USERNAME%

why are you doing that? the folders aren't made on the server yet? remove that line and see if it works better

also try run as administrator and see if it works?

i think you are better off doing this in Group Policy, what kind of server? If it is Server 08 they have the folder in GPO
 
If you don't want to go the Group Policy route try kixtart. I've been using that for a few years now and has been working well for alot of things such as mapped drives based on AD Security and so on
 
instead of using a login script, use group policy preferences. Since your script has no logic it can be done in preferences very easily.
 
what perms do the users have, both NTFS and share perms, on the USERS folder?
 
MD \\ruffles\rnfile\Users\%USERNAME%

why are you doing that? the folders aren't made on the server yet? remove that line and see if it works better

also try run as administrator and see if it works?

i think you are better off doing this in Group Policy, what kind of server? If it is Server 08 they have the folder in GPO

No, the folders weren't made yet. I added the line so it would create it when people logged. I am using Server 03.

what perms do the users have, both NTFS and share perms, on the USERS folder?

Special, just like every other user and group (including admin); everyone has the same permissions.
 
Last edited:
I am not the best script writer either, and In my efforts to do this I just I found this script on lazyadmin.

http://www.lazynetworkadmin.com/knowledgebase-mainmenu-6/2-windows/7-map-network-drive

Its a login script that creates mapped drives and printers based off a group list that it reads during a login. It works great. I just created the shared folder, set share and NTFS permission then defined which group it should be mapped to, the path, and drive letter in the group list.

Once you get up and running you can create a new mapped drive for all users or a specific group in seconds.
 
I am not the best script writer either, and In my efforts to do this I just I found this script on lazyadmin.

http://www.lazynetworkadmin.com/knowledgebase-mainmenu-6/2-windows/7-map-network-drive

Its a login script that creates mapped drives and printers based off a group list that it reads during a login. It works great. I just created the shared folder, set share and NTFS permission then defined which group it should be mapped to, the path, and drive letter in the group list.

Once you get up and running you can create a new mapped drive for all users or a specific group in seconds.

Not bad for basic vb script. Until something goes wrong and he has to attempt to fix it without knowing alot of vb scripting
 
yeah, we use some kix files here at work, which then pull up some batch files.
 
I know it all comes down to preference, but at this point I can't bring myself to learn a lot of vb after investing time in learning kix.

I'm going to water this down a bit, but here is an example kix script I created to map drives based on department and some printer stuff I had been working on.

Code:
;Check if the log file can be created:

;Set name for text log file.
$txtlog = "U:\txtlog.txt"

;Checks if U:\TxtLog.txt Exists
If 0=Exist ("U:\txtlog.txt")
    $rc = Open(1, "U:\txtlog.txt", 5)
    ;Close new empty text log.
    $rc = Close(1)
    SetFileAttr("U:\txtlog.txt", 2)
endif


;Super User Access
if ingroup ("SuperUsers")
drive_map('$fileserv',h,'home$')
drive_map('$fileserv',i,'departments$')
endif

; All Domain Users Get These Drives
if ingroup ("Domain Users")
drive_map('$fileserv',p,'public$')
endif

; Access Granted to those on a Committee
if ingroup ("Master_Committee")
drive_map('$fileserv',y,'committee$')
endif

;Acute Care Users
if ingroup ("Acute")
drive_map('$fileserv',m,'acute$')
drive_map('$fileserv',n,'ER$')
endif

Code:
$computerprt = left (@wksta, 3)

select 
    case $computerprt = "IS-"
        printer_map('$printserv','InfoSysOffice')
        printer_map('$printserv','InfosysStaff')
    case $computerprt = "LAB"
        printer_map('$printserv','Labrecption')
        printer_map('$printserv','LabWorkArea')
    case $computerprt = "LTC"
        printer_map('$printserv','LTCScan')
    case $computerprt = "MM-"
        printer_map('$printserv','MaterialsMgt')
    case $computerprt = "RAD"
        printer_map('$printserv','rad-work')
        printer_map('$printserv','rad-mammo')
        printer_map('$printserv','rad-recept')
endselect
;***************************************************************************************
; All of the Stuff needed for the training pc's
Select
    $training = @hostname
    ; CA Test Drive Mappings
    case INSTR($training,"gcmc-train")
        ? "Training PC"
        drive_map('$livec2kdb',r,'tcalimadm')
        drive_map('$tstmckdb',v,'vardata')
    ; Add training Printer
        printer_map('$printserv',"\training")
endselect
;***************************************************************************

;Set Screen Resolution for Mckesson Pharmacy Users
if ingroup ("Display")
    if 0=exist ("C:\MultiRes.exe")
        copy "\\@ldrive\multires.exe" "C:\"
    endif
    
    run "C:\multires.exe /1024,768,32,75 /exit"
endif

;***************************************************************************


;***************************************************************************

Sorry it's a lot to delve through, but wanted to get the point across.
 
Back
Top