What scripting language do you use?

D-boyD-boy Member Posts: 595 ■■□□□□□□□□
What scripting language do you use or prefer to use for logon scripts?

I am trying to use a sample vbs logon script below:


Const ENGINEERING_GROUP = "cn=engineering"
Const FINANCE_GROUP = "cn=finance"
Const HUMAN_RESOURCES_GROUP = "cn=human resources"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:",
"\\FileServer\Users\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, ENGINEERING_GROUP) Then

wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Engineering\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\EngLaser"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\Plotter"
wshNetWork.SetDefaultPrinter
"\\PrintServer\EngLaser"

ElseIf InStr(strGroups, FINANCE_GROUP) Then

wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Finance\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\FinLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\FinLaser"

ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Human Resources\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\HrLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\HrLaser"


I changed everything to fit my environment and it does not run….

Does anyone have a sample script I could use and just change for my environment?

I am running Windows 2003 servers and Windows XP…

I want the script to be able to check if they are a member of a particular group and then map the appropriate drives and printers, does anyone know how?

I am new to scripting and do not really know the best way or how, I have been to many scripting sites but still don't understand how to get one working correctly without errors......

d-boy

Comments

  • sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    I just use the plain old Windows shell (batch files). I use the resourse kit utility "ifmember.exe" like this:

    IFMEMBER ADMINS
    IF ERRORLEVEL 1 GOTO MAP-ADMINS
    IFMEMBER ENGINEERS
    IF ERRORLEVEL 1 GOTO MAP-ENGINEERS

    :MAP-ADMINS
    NET USE H: \\SERVER\ADMINS_SHARE
    GOTO END

    :MAP-ENGINEERS
    NET USE H: \\SERVER\ENGINEERS_SHARE
    GOTO END

    :END
    All things are possible, only believe.
  • SmallguySmallguy Member Posts: 597
    sprkymrk wrote:
    I just use the plain old Windows shell (batch files). I use the resourse kit utility "ifmember.exe" like this:

    IFMEMBER ADMINS
    IF ERRORLEVEL 1 GOTO MAP-ADMINS
    IFMEMBER ENGINEERS
    IF ERRORLEVEL 1 GOTO MAP-ENGINEERS

    :MAP-ADMINS
    NET USE H: \\SERVER\ADMINS_SHARE
    GOTO END

    :MAP-ENGINEERS
    NET USE H: \\SERVER\ENGINEERS_SHARE
    GOTO END


    :END

    same thing we use as well but we only use it to map network drives
  • garv221garv221 Member Posts: 1,914
    sprkymrk wrote:
    I just use the plain old Windows shell (batch files). I use the resourse kit utility "ifmember.exe" like this:

    IFMEMBER ADMINS
    IF ERRORLEVEL 1 GOTO MAP-ADMINS
    IFMEMBER ENGINEERS
    IF ERRORLEVEL 1 GOTO MAP-ENGINEERS

    :MAP-ADMINS
    NET USE H: \\SERVER\ADMINS_SHARE
    GOTO END

    :MAP-ENGINEERS
    NET USE H: \\SERVER\ENGINEERS_SHARE
    GOTO END

    :END

    Same as well. icon_thumright.gif Keep it simple
Sign In or Register to comment.