#1 30 Jul 2009 19:57

strict
Member
Registered: 15 Jan 2009
Posts: 15

MS "scripting guy" sucks

i got this script from the MS "scripting guy"... i really like the simplicity, surprise! it does not work... this AWESOME forum has helped me in the past... i am hoping someone can help me get this script going the goal being to keep it as simple as possible... maybe there is a cool powershell way to do this?

again, as few lines as possible is the idea here:

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN

    Select Case strGroupName
        Case "CAD USERS"
            objNetwork.MapNetworkDrive "H:", "\\capsac\network\cad_projects"
        Case "CAD VIEWERS"
            objNetwork.MapNetworkDrive "H:", "\\capsac\network\cad_projects"
        Case "Domain Users"
            objNetwork.MapNetworkDrive "L:", "\\capsac\network\project_docs"
        Case "MasterSpec"
            objNetwork.MapNetworkDrive "S:", "\\capsac\network\master_specs"
        Case "Master Spec Editors"
            objNetwork.MapNetworkDrive "S:", "\\capsac\network\master_specs"
        Case "Domain Users"
            objNetwork.MapNetworkDrive "T:", "\\capsac\network\office_templates"
        Case "Database Readers"
            objNetwork.MapNetworkDrive "K:", "\\capsac\network\database"
        Case "Database Editors"
            objNetwork.MapNetworkDrive "K:", "\\capsac\network\database"
        Case "Accounting"
            objNetwork.MapNetworkDrive "J:", "\\capsac\network\cfms"
        Case "Account Share"
            objNetwork.MapNetworkDrive "J:", "\\capsac\network\cfms"
        Case "Bluebook Readers"
            objNetwork.MapNetworkDrive "J:", "\\capsac\network\cfms"
        Case "Marketing"
            objNetwork.MapNetworkDrive "M:", "\\capsac\network\marketing"
        Case "Human Resources"
            objNetwork.MapNetworkDrive "P:", "\\capsac\network\hr"
        Case "Administrative"
            objNetwork.MapNetworkDrive "O:", "\\capsac\network\administrative"
        Case "Anthony's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\AC's_Team"
        Case "Andy's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\Andy's_Team"
        Case "Bryan's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\Bryan's_Team"
        Case "Chuck's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\Chuck's_Team"
        Case "Mike's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\Mike's_Team"
        Case "Steve's Team"
            objNetwork.MapNetworkDrive "I:", "\\capsac\network\TeamShare\Steve's_Team"
        Case "Domain Users"
            objNetwork.MapNetworkDrive "U:", "\\capsac\user\user_home\%USERNAME%$"
        Case "Domain Users"
            objNetwork.MapNetworkDrive "N:", "\\capsac\network"
        Case "HPLJ1320-01-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1320n"
            objNetwork.SetDefaultPrinter "\\augusta\HP 1320n"
        Case "HPLJ1320-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1320n"
        Case "HPLJ1300-02-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP1300-2"
            objNetwork.SetDefaultPrinter "\\augusta\HP1300-2"
        Case "HPLJ1300-02"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP1300-2"
        Case "HPLJ1300-03-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP1300-3"
            objNetwork.SetDefaultPrinter "\\augusta\HP1300-3"
        Case "HPLJ1300-03"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP1300-3"
        Case "HPLJ1300-04-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1300-4"
            objNetwork.SetDefaultPrinter "\\augusta\HP 1300-4"
        Case "HPLJ1300-04"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1300-4"
        Case "HPLJ1320-05-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1320-5"
            objNetwork.SetDefaultPrinter "\\augusta\HP 1320-5"
        Case "HPLJ1320-05"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP 1320-5"
        Case "HPLJ2015-01-DEFAULT"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP2015-1"
            objNetwork.SetDefaultPrinter "\\augusta\HP2015-1"
        Case "HPLJ2015-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP2015-1"
        Case "HPLJ4000-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP4000"
        Case "HPLJ5000-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HP5000-1"
        Case "HPLJ5000-02"
            objNetwork.AddWindowsPrinterConnection "\\augusta\HPLaserJet 5000-2"
        Case "PDFFACTORY-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\pdfFactory"
        Case "SHARPM237-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\SHARPAR-M237"
        Case "SHARPM550-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\Sharp M550N"
        Case "XEROX7400-01"
            objNetwork.AddWindowsPrinterConnection "\\augusta\XeroxPhaser 7400DT"
   
    End Select
Next

any help is very appreciated... thank you!!!

-mark

Offline

#2 08 Nov 2009 19:56

Jim de Graff
Member
From: Winnipeg, Manitoba
Registered: 08 Nov 2009
Posts: 2

Re: MS "scripting guy" sucks

There are many ways for a script to "not work". Exactly how does it fail? What error messages are you getting? Is it failing because the helper objects are not being created? Is one of the methods failing? I assume this is a login script. As such, the results are either hidden from the user, or meaningless to the user. All login scripts should create or append to a log file for just this type of troubleshooting.

When you tell the Doctor you are not feeling well you don't expect him to diagnose the problem without more information.


Sacred cows make the tastiest burgers.

Offline

#3 14 Mar 2015 10:08

oswaldwark
New Member
Registered: 14 Mar 2015
Posts: 1

Re: MS "scripting guy" sucks

What error messages are you getting????


raza

Offline

Board footer

Powered by FluxBB