Jump to content

Login script log file


Recommended Posts

I posted this yesterday, but I responded to myself thinking I had resolved the issue. While I got closer to fixing the script, it's still not working right.

What I am trying to achieve is to receive information of what Computer, IP address and the date/time a user is logging into the network with. This information needs to be exported to a CSV file. Depending on the users security groups membership, the users information is exported to specific file.

I am still learning about Auto IT, but I feel this project has taught me a lot already! So I tried using IF, ELSEIF, ENDIF statements, but that didn't work. I then made use of the SELECT, CASE, ENDSELECT statement to achieve the desired results. While it looks neater, and works the same, it didn't end up resolving the problem. I tried SWITCH too, but that stopped the script from compiling completely.

The script runs fine, and logged in as a DOMAIN ADMIN the CSV file is created. Any other security groups do not create a file. The DOMAIN ADMIN group is the first group in the SELECT CASE statement. It seems preceeding CASE statements have no effect.

If I just use 2 security groups and use the IF and ELSE statements, the scripts performs as it should. Unfortunately I have more than 2 security groups.

Any help on this would be much appreciated. This is the script:

#include <WindowsConstants.au3>
#include <adfunctions.au3>

$TITLE = ("Username, Computer Name, IP Address, Time, Date")
$Login = (@UserName & "," & @ComputerName & "," & @IPAddress1 & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & @MON & "/" & @MDAY & "/" & @YEAR)
$DA = True ;==> Domain Admins
$T = True ;==> Teachers
$S = True ;==> Students
$O = True ;==> Office
$CSHT = True ; ==> CSH Teachers
$CSHS = True ;==> CSH Students
$CSHO = True ;==> CSH Office
$EMST = True ; ==> EMS Teachers
$EMSS = True ;==> EMS Students
$EMSO = True ;==> EMS Office
$TCHST = True ; ==> TCHS Teachers
$TCHSS = True ;==> TCHS Students
$TCHSO = True ;==> TCHS Office
$WMST = True ; ==> WMS Teachers
$WMSS = True ;==> WMS Students
$WMSO = True ;==> WMS Office
$WSHT = True ;==> WSH Teachers
$WSHS = True ;==> WSH Students
$WSHO = True ;==> WSH Office

;==> These functions will do the part of adding a record to the log in the CSV file.
;==> The records are added to the particular log depending on the security group.
;==> Each function is named by the security group.

Func DomainAdmins()
    If FileReadLine("\\app2\logs$\Domain Admins Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    EndIf
EndFunc   ;==>DomainAdmins

Func Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>Teachers

Func Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>Students

Func Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>Office

Func CSH_Teachers()
    If FileReadLine("\\app2\logs$\CSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Teachers

Func CSH_Students()
    If FileReadLine("\\app2\logs$\CSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Students

Func CSH_Office()
    If FileReadLine("\\app2\logs$\CSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Office

Func EMS_Teachers()
    If FileReadLine("\\app2\logs$\EMS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Teachers

Func EMS_Students()
    If FileReadLine("\\app2\logs$\EMS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Students

Func EMS_Office()
    If FileReadLine("\\app2\logs$\EMS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Office

Func TCHS_Teachers()
    If FileReadLine("\\app2\logs$\TCHS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Teachers

Func TCHS_Students()
    If FileReadLine("\\app2\logs$\TCHS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Students

Func TCHS_Office()
    If FileReadLine("\\app2\logs$\TCHS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Office

Func WMS_Teachers()
    If FileReadLine("\\app2\logs$\WMS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Teachers

Func WMS_Students()
    If FileReadLine("\\app2\logs$\WMS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Students

Func WMS_Office()
    If FileReadLine("\\app2\logs$\WMS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Office

Func WSH_Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Teachers

Func WSH_Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Students

Func WSH_Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Office

;==>
Select
    Case $DA
If _ADIsMemberOf("Domain Admins","") = True Then
    Call("DomainAdmins")
EndIf
    Case $T
If _ADIsMemberOf("Teachers","") = True Then
    Call("Teachers")
EndIf
    Case $S
If _ADIsMemberOf("Students","") = True Then
    Call("Students")
EndIf
    Case $O
If _ADIsMemberOf("Office","") = True Then
    Call("Office")
EndIf
    Case $CSHT
If _ADIsMemberOf("CSH_Teachers","") = True Then
    Call("CSH_Teachers")
EndIf
    Case $CSHS
If _ADIsMemberOf("CSH_Students","") = True Then
    Call("CSH_Students")
EndIf
    Case $CSHO
If _ADIsMemberOf("CSH_Office","") = True Then
    Call("CSH_Office")
EndIf
    Case $EMST
If _ADIsMemberOf("EMS_Teachers","") = True Then
    Call("EMS_Teachers")
EndIf
    Case $EMSS
If _ADIsMemberOf("EMS_Students","") = True Then
    Call("EMS_Students")
EndIf
    Case $EMSO
If _ADIsMemberOf("EMS_Office","") = True Then
    Call("EMS_Office")
EndIf
    Case $TCHST
If _ADIsMemberOf("TCHS_Teachers","") = True Then
    Call("TCHS_Teachers")
EndIf
    Case $TCHSS
If _ADIsMemberOf("TCHS_Students","") = True Then
    Call("TCHS_Students")
EndIf
    Case $TCHSO
If _ADIsMemberOf("TCHS_Office","") = True Then
    Call("TCHS_Office")
EndIf
    Case $WMST
If _ADIsMemberOf("WMS_Teachers","") = True Then
    Call("WMS_Teachers")
EndIf
    Case $WMSS
If _ADIsMemberOf("WMS_Students","") = True Then
    Call("WMS_Students")
EndIf
    Case $WMSO
If _ADIsMemberOf("WMS_Office","") = True Then
    Call("WMS_Office")
EndIf
    Case $WSHT
If _ADIsMemberOf("WSH_Teachers","") = True Then
    Call("WSH_Teachers")
EndIf
    Case $WSHS
If _ADIsMemberOf("WSH_Students","") = True Then
    Call("WSH_Students")
EndIf
    Case $WSHO
If _ADIsMemberOf("WSH_Office","") = True Then
    Call("WSH_Office")
EndIf
EndSelect
Link to comment
Share on other sites

Hi,

Hopefully i understand what you want.

you have to use ContinueCase in every Case statement, to check the other cases.

Select
    Case $DA
        If _ADIsMemberOf("Domain Admins","") Then DomainAdmins ()
        ContinueCase
    Case $T
        If _ADIsMemberOf("Teachers","") Then Teachers ()
        ContinueCase
    Case $S
        If _ADIsMemberOf("Students","") Then Students ()
        ContinueCase
    Case $O
        If _ADIsMemberOf("Office","") = Then Office ()
        ContinueCase
;.... to be continued

If you want to create a csv for every security group a user is meber of, you do not need the assign of

$DA = True ;==> Domain Admins

$T = True ;==> Teachers

......

and your Select Case.

Just check with some if statements:

If _ADIsMemberOf("Domain Admins","") Then DomainAdmins ()
If _ADIsMemberOf("Teachers","") Then Teachers ()
If _ADIsMemberOf("Students","") Then Students ()
If _ADIsMemberOf("Office","") Then Office ()
;.... to be continued

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

Thank you both for your quick replies. I think I tried using the IF statements before, but just to make sure I ran it again. Unfortunately it still doesn't work. Just to be sure that is isn't a permissions issue, the shared folder that the log is being written too has everyone with modify rights for both NTFS and share permissions.

So this is part of what I currently have:

;==> Current school security groups
If _ADIsMemberOf("Domain Admins", "") Then
    DomainAdmins()
EndIf
If _ADIsMemberOf("Teachers", "") Then
    Teachers()
EndIf
If _ADIsMemberOf("Students", "") Then
    Students()
EndIf
If _ADIsMemberOf("Office", "") Then
    Office()
EndIf

These are the functions that are still being used and haven't been modified:

;==> These functions will do the part of adding a record to the log in the CSV file.
;==> The records are added to the particular log depending on the security group.
;==> Each function is named by the security group.

Func DomainAdmins()
    If FileReadLine("\\app2\logs$\Domain Admins Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    EndIf
EndFunc   ;==>DomainAdmins

Func Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>Teachers

Func Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>Students

Func Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>Office

So what it is now doing when I log in as a Domain Admin, is it is creating a csv files for each security group and placing my login in all 4 log files. I only want my entry to appear in the Domain Admins file.

However, if I log in as a user who is a member of the "Teachers" security group, no files are created, and/or no entries in the existing logs are added.

I have also tried using this script to now avail:

#include <WindowsConstants.au3>
#include <adfunctions.au3>

$TITLE = ("Username, Computer Name, IP Address, Time, Date")
$Login = (@UserName & "," & @ComputerName & "," & @IPAddress1 & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & @MON & "/" & @MDAY & "/" & @YEAR)
$DA = True ;==> Domain Admins
$T = True ;==> Teachers
$S = True ;==> Students
$O = True ;==> Office
$CSHT = True ; ==> CSH Teachers
$CSHS = True ;==> CSH Students
$CSHO = True ;==> CSH Office
$EMST = True ; ==> EMS Teachers
$EMSS = True ;==> EMS Students
$EMSO = True ;==> EMS Office
$TCHST = True ; ==> TCHS Teachers
$TCHSS = True ;==> TCHS Students
$TCHSO = True ;==> TCHS Office
$WMST = True ; ==> WMS Teachers
$WMSS = True ;==> WMS Students
$WMSO = True ;==> WMS Office
$WSHT = True ;==> WSH Teachers
$WSHS = True ;==> WSH Students
$WSHO = True ;==> WSH Office

;==> These functions will do the part of adding a record to the log in the CSV file.
;==> The records are added to the particular log depending on the security group.
;==> Each function is named by the security group.

Func DomainAdmins()
    If FileReadLine("\\app2\logs$\Domain Admins Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    EndIf
EndFunc   ;==>DomainAdmins

Func Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>Teachers

Func Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>Students

Func Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>Office

Func CSH_Teachers()
    If FileReadLine("\\app2\logs$\CSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Teachers

Func CSH_Students()
    If FileReadLine("\\app2\logs$\CSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Students

Func CSH_Office()
    If FileReadLine("\\app2\logs$\CSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\CSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>CSH_Office

Func EMS_Teachers()
    If FileReadLine("\\app2\logs$\EMS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Teachers

Func EMS_Students()
    If FileReadLine("\\app2\logs$\EMS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Students

Func EMS_Office()
    If FileReadLine("\\app2\logs$\EMS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\EMS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>EMS_Office

Func TCHS_Teachers()
    If FileReadLine("\\app2\logs$\TCHS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Teachers

Func TCHS_Students()
    If FileReadLine("\\app2\logs$\TCHS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Students

Func TCHS_Office()
    If FileReadLine("\\app2\logs$\TCHS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\TCHS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>TCHS_Office

Func WMS_Teachers()
    If FileReadLine("\\app2\logs$\WMS - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Teachers

Func WMS_Students()
    If FileReadLine("\\app2\logs$\WMS - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Students

Func WMS_Office()
    If FileReadLine("\\app2\logs$\WMS - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WMS - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>WMS_Office

Func WSH_Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Teachers

Func WSH_Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Students

Func WSH_Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>WSH_Office

;==>
Select
    Case $DA
If _ADIsMemberOf("Domain Admins","") Then DomainAdmins()
    ContinueCase

    Case $T
If _ADIsMemberOf("Teachers","") Then Teachers()
    ContinueCase

    Case $S
If _ADIsMemberOf("Students","") Then Students()
    ContinueCase

    Case $O
If _ADIsMemberOf("Office","") Then Office()
    ContinueCase

    Case $CSHT
If _ADIsMemberOf("CSH_Teachers","") Then CSH_Teachers()
    ContinueCase

    Case $CSHS
If _ADIsMemberOf("CSH_Students","") Then CSH_Students()
    ContinueCase

    Case $CSHO
If _ADIsMemberOf("CSH_Office","") Then CSH_Office()
    ContinueCase

    Case $EMST
If _ADIsMemberOf("EMS_Teachers","") Then EMS_Teachers()
    ContinueCase

    Case $EMSS
If _ADIsMemberOf("EMS_Students","") Then EMS_Students()
    ContinueCase

    Case $EMSO
If _ADIsMemberOf("EMS_Office","") Then EMS_Office()
    ContinueCase

    Case $TCHST
If _ADIsMemberOf("TCHS_Teachers","") Then TCHS_Teachers()
    ContinueCase

    Case $TCHSS
If _ADIsMemberOf("TCHS_Students","") Then TCHS_Students()
    ContinueCase

    Case $TCHSO
If _ADIsMemberOf("TCHS_Office","") Then TCHS_Office()
    ContinueCase

    Case $WMST
If _ADIsMemberOf("WMS_Teachers","") Then WMS_Teachers()
    ContinueCase

    Case $WMSS
If _ADIsMemberOf("WMS_Students","") Then WMS_Students()
    ContinueCase

    Case $WMSO
If _ADIsMemberOf("WMS_Office","") Then WMS_Office()
    ContinueCase

    Case $WSHT
If _ADIsMemberOf("WSH_Teachers","") Then WSH_Teachers()
    ContinueCase

    Case $WSHS
If _ADIsMemberOf("WSH_Students","") Then WSH_Students()
    ContinueCase

    Case $WSHO
If _ADIsMemberOf("WSH_Office","") Then WSH_Office()
    ContinueCase
EndSelect

Thanks again for your help. Do you guys have any other ideas?

Link to comment
Share on other sites

Just to add to this in case the _ADIsMemberOf function is messed up. I changed the _ADIsMemberOf function in the adfunctions.au3 include file, because I kept receiving COM errors.

This is what the ADfunctions.au3 file looked like before:

; _ADIsMemberOf
; Takes Full Distringuished Names for a group and a user
; Returns 1 if the the user is a member of the group, 0 otherwise, -1 if access is denied/group not found

Func _ADIsMemberOf($group, $user)
    $ObjGroup = _ADObjGet("LDAP://" & $strHostServer & "/" & $group)
    If Not IsObj($ObjGroup) Then Return -1
    $ismember = $ObjGroup.IsMember("LDAP://" & $strHostServer & "/" & $user)
    $ObjGroup = 0
    Return -$ismember
EndFunc   ;==>_ADIsMemberOf

I found a post that someone had modified the _ADIsMemberOf function, and this then allowed the script to run without COM errors.

This is the modified _ADIsMemberOf function:

; _ADIsMemberOf
; Takes the groupname (SamAccountName with or without the leading 'CN=', and the SamAccountName of the user
; Returns 1 if the the user is a member of the group, 0 otherwise
; Alternate test by Arcker, uses only AD search
; really fast

Func _ADIsMemberOf($group, $user)
    If StringLeft($group, 3) <> "CN=" Then
        $group = "CN=" & $group
    EndIf
    Dim $usergroups[1], $i = 1

    Dim $objConnection, $oUsr,$groupdn


    $objConnection = ObjCreate("ADODB.Connection")  ; Create COM object to AD
    $objConnection.Provider = "ADsDSOObject"
    $objConnection.Open ("Active Directory Provider")  ; Open connection to AD
    $objRootDSE = ObjGet("LDAP://RootDSE")
    Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext")  ; Retrieve the current AD domain name

    $strQuery = "<LDAP://" & $strDNSDomain & ">;(" &$group& ");distinguishedName;subtree"
    $objRecordSet = $objConnection.Execute ($strQuery)  ; Retrieve the FQDN for the logged on user
    if $objRecordSet.eof then
        SetError(2)
        Return 0 ;group non found
    Else
        $groupdn=$objRecordSet.fields(0).value
    EndIf
    $strQuery = "<LDAP://" & $strDNSDomain & ">;((sAMAccountName=" & $user & ")(memberof="&$groupdn&"));ADsPath;subtree"
    $objRecordSet = $objConnection.Execute ($strQuery)  ; Retrieve the FQDN for the logged on user
    if $objRecordSet.eof then
        SetError(1)
        Return 0
    Else
        return 1
    EndIf

EndFunc   ;==>_ADIsMemberOf

Could this be my problem?

The COM error is:

We intercepted a COM Error!

Number is: 80072032

Windescription is: An invalid dn syntax has been specified.

Script Line number is 1869.

The COM error seems to pop up for every security group that I have listed.

Link to comment
Share on other sites

Hi,

i don't know why you get this errors. But first at all you should:

Start Button -> run -> \\app2\logs$ and create an text file to verify access on share

I worked with adfunctions before, but work now with the ad.au3 from water. It's more functional.

I recode a little bit with the functions of water, but i haven't had an AD here to test with.

You can download ad.au3 here. Just extract only the ad.au3, but you can extract all if you want to.

The other functions could be used seperate und you have a function description in the htm file.

http://www.autoitscript.com/forum/index.php?showtopic=106163&st=0

So heres my code with some error checking for file access as well:

#include <ad.au3>
#include <array.au3>
#Include <File.au3>

check ()
init ()
Main ()

Func init ()
    Global $argroups
    Global $TITLE = ("Username, Computer Name, IP Address, Time, Date")
    Global $Login = (@UserName & "," & @ComputerName & "," & @IPAddress1 & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & @MON & "/" & @MDAY & "/" & @YEAR)
EndFunc

Func check ()
    _FileCreate("\\app2\logs$\Check Log.csv")
    If @error Then 
        MsgBox (0,"Error", "Error " & @error & ". Exit Program!")
        Exit
    Else
        FileDelete("\\app2\logs$\Check Log.csv")
    EndIf
EndFunc

Func Main ()
    _ad_open ()
    $argroups = _AD_GetUserGroups (@UserName)
    _ad_close ()
    If _ArraySearch($argroups, "Domain Admins") Then 
        DomainAdmins ()
    ElseIf _ArraySearch($argroups, "Teachers") Then 
        Teachers ()
    ElseIf _ArraySearch($argroups, "Students") Then 
        Students ()
    ElseIf _ArraySearch($argroups, "Office") Then   
        Office ()
    EndIf
EndFunc

;==> These functions will do the part of adding a record to the log in the CSV file.
;==> The records are added to the particular log depending on the security group.
;==> Each function is named by the security group.

Func DomainAdmins()
    If FileReadLine("\\app2\logs$\Domain Admins Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\Domain Admins Log.csv", $Login)
    EndIf
EndFunc   ;==>DomainAdmins

Func Teachers()
    If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
    EndIf
EndFunc   ;==>Teachers

Func Students()
    If FileReadLine("\\app2\logs$\WSH - Students Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Students Log.csv", $Login)
    EndIf
EndFunc   ;==>Students

Func Office()
    If FileReadLine("\\app2\logs$\WSH - Office Log.csv", 1) = $TITLE Then
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    Else
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $TITLE)
        FileWriteLine("\\app2\logs$\WSH - Office Log.csv", $Login)
    EndIf
EndFunc   ;==>Office

;-))

Stefan

P.S: The code is just typed and not tested....

@Edit: Correct some paste and copy errors... :(

@Edit2: Shorter version. If you don't want function check remove line #include <file.au3> and function.

#include <ad.au3>
#include <array.au3>
#Include <File.au3>

check ()
init ()
main ()

Func init ()
    Global $argroups
    Global $TITLE = ("Username, Computer Name, IP Address, Time, Date")
    Global $Login = (@UserName & "," & @ComputerName & "," & @IPAddress1 & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & @MON & "/" & @MDAY & "/" & @YEAR)
    Global $server = "\\app2\logs$\"
EndFunc

Func check ()
    _FileCreate ("\\app2\logs$\Check Log.csv")
    If @error Then 
        MsgBox (0,"Error", "Error " & @error & ". Exit Program!")
        Exit
    Else
        FileDelete ("\\app2\logs$\Check Log.csv")
    EndIf
EndFunc

Func main ()
    _ad_open ()
    $argroups = _AD_GetUserGroups (@UserName)
    _ad_close ()
    If _ArraySearch($argroups, "Domain Admins") Then 
        writecsv ("Domain Admins Log.csv")
    ElseIf _ArraySearch($argroups, "Teachers") Then 
        writecsv ("WSH - Teachers Log.csv")
    ElseIf _ArraySearch($argroups, "Students") Then 
        writecsv ("WSH - Students Log.csv")
    ElseIf _ArraySearch($argroups, "Office") Then   
        writecsv ("WSH - Students Log.csv")
    EndIf
EndFunc

Func writecsv ($log)
        If FileReadLine($server & $log, 1) = $TITLE Then
        FileWriteLine($server & $log, $Login)
    Else
        FileWriteLine($server & $log, $TITLE)
        FileWriteLine($server & $log, $Login)
    EndIf
EndFunc

@Edit3: I believe that _ArraySearch will fail, because the array will contain FQDN group names and not SAM Account names.

If code is failing, change function main () as follows and remove #inlude <array.au3>:

Func main ()
    _ad_open ()
    If _AD_IsMemberOf ("Domain Admins") Then 
        writecsv ("Domain Admins Log.csv")
    ElseIf _AD_IsMemberOf ("Teachers") Then 
        writecsv ("WSH - Teachers Log.csv")
    ElseIf _AD_IsMemberOf ("Students") Then 
        writecsv ("WSH - Students Log.csv")
    ElseIf _AD_IsMemberOf ("Office") Then   
        writecsv ("WSH - Students Log.csv")
    EndIf   
    _ad_close ()
EndFunc

Sry for bad coding, but i have no test possibilities at home yet and i'm tired and go to bed now....

Edited by 99ojo
Link to comment
Share on other sites

Thanks again Stefan. Just before I got this message, I found the AD.au3 UDF and tried using it. I kept getting an error with the _AD_IsMemberOf function though, so I emailed Water to see what he could make of it.

I tried your script and I know you said it was un tested, but I tried tinkering around with it. I still cannot get it to record anything other the Domain Admins.

I think everything looks good. I have tried so many different alternatives that I am about to give up and just created an individual log script for each group and run it in our kix script against the specified security groups.

It'd have been nice to have had just one, but I am feeling beaten here! :-) I'll probably keep trying stuff because I hate to feel defeated!

Link to comment
Share on other sites

Hi,

Following code is tested on AD with AutoIT 3.3.4.0 and Win XP SP3.

For debugging login as a member of teacher group:

#include <ad.au3>
_ad_open ()
$var = _AD_IsMemberOf ("Teacher")
_ad_close ()
consolewrite ($var & @crlf) ; should be 1, otherwise problem with domain
If $var Then 
    $test = FileWrite ("\\app2\logs$\Check teacher.csv", "I'm a teacher")
    consolewrite ($test); should be 1, otherwise problem with writing file
EndIf

;-))

Stefan

Link to comment
Share on other sites

Stefan,

Thanks for the time you've put in on this. I tried the script you sent, but it did not create a file.

Our domain setup uses multiple child domains right now. We consolidating this to 1 domain for the beginning of the next school year, but I am wondering if the multiple child domains is messing things up.

I guess what I'll do for now is use 1 script for each security group and run this within our kix login script that checks for security group membership.

This is what I am using in my log creation script:

$TITLE = ("Username, Computer Name, IP Address, Time, Date")
$Login = (@UserName & "," & @ComputerName & "," & @IPAddress1 & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & @MON & "/" & @MDAY & "/" & @YEAR)
If FileReadLine("\\app2\logs$\WSH - Teachers Log.csv", 1) = $TITLE Then
    FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
Else
    FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $TITLE)
    FileWriteLine("\\app2\logs$\WSH - Teachers Log.csv", $Login)
EndIf

I have created one of these for my office and teaching staff, and one for students.

I then told my kix script to look for this script if they are a member of a specific group and run the script.

The kix script looks like this:

; mapDrive("driveletter","UNC Path","Optional Desired label", "Optional Icon path","optional Delete", "optional persistent")
Function MapDrive($DriveLetter, $UNC, optional $Label, optional $Icon, optional $Delete, optional $persistent)  
    dim $subcmd, $pt, $d, $di, $shell, $per
    $d = left($DriveLetter,1)
    $di= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons"
    $iP= "HKEY_CLASSES_ROOT\Applications\explorer.exe\Drives"
    $pt= @producttype
    if $pt = "Windows NT Workstation"
        $subcmd="subst"
        $per=''
    else
        $subcmd="net use"
        if $persistent      $per='/PERSISTENT '     endif
        endif
    if $delete
        shell '%comspec% /c $subcmd $d: /d $per 1>Nul 2>&1'
        $=deltree("$di\$D")
    endif
    shell '%comspec% /c $subcmd $D: "$UNC" $per 1>Nul 2>&1'
        if not exist('$D:\')        exit 1      return      endif
    if $pt="Windows XP Professional" or $pt="Windows 2000 Professional"
        if $Label
            $shell=createobject("shell.application")
            $shell.namespace('$D:\').self.name=$Label
            endif
        if $icon
            $=writevalue('$di\$D\DefaultIcon','','$Icon',REG_SZ)
            $=writevalue('$iP\$D\DefaultIcon\','','$Icon',REG_SZ)
        endif
    endif
EndFunction

Use H: /Delete /Persistent
Use I: /Delete /Persistent
Use J: /Delete /Persistent
Use K: /Delete /Persistent
Use L: /Delete /Persistent
Use M: /Delete /Persistent
Use N: /Delete /Persistent
Use O: /Delete /Persistent
Use P: /Delete /Persistent
Use Q: /Delete /Persistent
Use R: /Delete /Persistent
Use S: /Delete /Persistent
Use T: /Delete /Persistent
Use V: /Delete /Persistent
Use W: /Delete /Persistent
Use X: /Delete /Persistent
Use Y: /Delete /Persistent
Use Z: /Delete /Persistent

Select

Case INGroup ("Domain Admins")
    MapDrive("M:","\\app2\apps$\6-12","M Drive - Apps")
    MapDrive("Y:","\\operserver2\techdownloads","Y Drive - Techdownloads")
    MapDrive("Z:","\\staffstore2\Userdata$\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("Office")
    Shell "\\wshdc\netlogon\OfficeLogs.exe"
    MapDrive ("M:","\\wshserver2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("O:","\\staffshare1\departmentshares$\Officeshare\WSH","O Drive - Office Share")
    MapDrive ("P:","\\wshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\StuStore1\userdata$\HS\WSH","S Drive - Student Home Directories")
    MapDrive ("T:","\\StaffShare1\DepartmentShares$\TeacherShare\WSH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")    
Case INGroup ("Students")
    Shell "\\wshdc\netlogon\StudentLogs.exe"
    MapDrive ("H:","\\StuStore1\Netbaskets\WSH","H Drive - Netbaskets")
    MapDrive ("K:","\\app2\apps$\6-12\Math\Fathom 2","K Drive - Fathom 2")
    MapDrive ("M:","\\wshserver2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("Z:","\\StuStore1\userdata$\HS\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("Teachers")
    Shell "\\wshdc\netlogon\TeacherLogs.exe"
    MapDrive ("H:","\\StuStore1\Netbaskets\WSH","H Drive - Netbaskets")
    MapDrive ("M:","\\wshserver2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("P:","\\wshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("Q:","\\AuxStorage\WSHPhoto$","Q Drive - Photos")
    MapDrive ("S:","\\StuStore1\userdata$\HS\WSH","S Drive - Student Home Directories")
    MapDrive ("T:","\\StaffShare1\DepartmentShares$\TeacherShare\WSH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")

Case INGroup ("CSH_Office")
    MapDrive ("M:","\\CshServer2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("O:","\\Cshserver2\officeshare$","O Drive - Office Share")
    MapDrive ("P:","\\Cshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\Cshserver2\Userdata$\Students","S Drive - Student Home Directories")
    MapDrive ("T:","\\Cshserver2\TeacherShare$","T Drive - Teacher Share")
    MapDrive ("Z:","\\staffstore1\userdata$\CHS\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("CSH_Students")
    MapDrive ("H:","\\CshServer2\NetBaskets$","H Drive - Netbaskets")   
    MapDrive ("M:","\\CshServer2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("P:","\\AuxStorage\cshphoto$","P Drive - Photos")
    MapDrive ("Y:","\\cshserver2\Publishing$","Y Drive - Publishing")
    MapDrive ("Z:","\\stustore1\userdata$\HS\CHS\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("CSH_Teachers")
    MapDrive ("H:","\\CshServer2\NetBaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\CshServer2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("P:","\\Cshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\Cshserver2\Userdata$\Students","S Drive - Student Home Directories")
    MapDrive ("T:","\\Cshserver2\TeacherShare$","T Drive - Teacher Share")
    MapDrive ("Z:","\\staffstore1\userdata$\CHS\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("EMS_Office")
    MapDrive ("H:","\\EJHSERVER2\NetBaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\EJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("O:","\\EJHSERVER2\OFFICESHARE","O Drive - Office Share")
    MapDrive ("P:","\\EJHSERVER2\Pinnacle$","P Drive - Pinnacle")
    MapDrive ("Q:","\\AuxStorage\EMSPhoto$","Q Drive - Photos")
    MapDrive ("S:","\\EJHServer2\Userdata$\students","S Drive - Student Home Directories")
    MapDrive ("T:","\\EJHSERVER2\Teachershare","T Drive - Teacher Share")
    MapDrive ("Z:","\\EJHserver2\Userdata$\Office\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("EMS_Students")
    MapDrive ("H:","\\EJHSERVER2\NetBaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\EJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("Q:","\\AuxStorage\EMSPhoto$","Q Drive - Photos")
    MapDrive ("Z:","\\EJHserver2\Userdata$\Students\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("EMS_Teachers")
    MapDrive ("H:","\\EJHSERVER2\NetBaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\EJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("P:","\\EJHSERVER2\Pinnacle$","P Drive - Pinnacle")
    MapDrive ("Q:","\\AuxStorage\EMSPhoto$","Q Drive - Photos")
    MapDrive ("S:","\\EJHServer2\Userdata$\students","S Drive - Student Home Directories")
    MapDrive ("T:","\\EJHSERVER2\Teachershare","T Drive - Teacher Share")
    MapDrive ("Z:","\\EJHserver2\Userdata$\Teachers\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("WMS_Office")
    MapDrive ("K:","\\wjhserver2\teachershare","K Drive - Teacher Share")
    MapDrive ("M:","\\WJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - K6-12 Apps")
    MapDrive ("O:","\\wJHSERVER2\Userdata$\officeshare","O Drive - Office Share")
    MapDrive ("P:","\\wJHSERVER2\Pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\wJHSERVER2\Userdata$\students","S Drive - Student Home Directories")
    MapDrive ("Z:","\\WJHserver2\Userdata$\Office\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("WMS_Students")
    MapDrive ("G:","\\WJHSERVER2\graphics$","G Drive - Graphics")
    MapDrive ("H:","\\wjhserver2\netbaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\WJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - K6-12 Apps")
    MapDrive ("P:","\\auxstorage\wmsphoto$","P Drive - Photos")
    MapDrive ("Z:","\\WJHserver2\Userdata$\Students\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("WMS_Teachers")
    MapDrive ("H:","\\wjhserver2\netbaskets$","H Drive - Netbaskets")
    MapDrive ("M:","\\WJHSERVER2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - K6-12 Apps")
    MapDrive ("P:","\\wJHSERVER2\Pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\wJHSERVER2\Userdata$\students","S Drive - Student Home Directories")
    MapDrive ("T:","\\wJHSERVER2\teachershare","T Drive - Teacher Share")
    MapDrive ("Q:","\\auxstorage\wmsphoto$","Q Drive - Photos")
    MapDrive ("Z:","\\WJHserver2\Userdata$\Teachers\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("WSH_Office")
    MapDrive ("M:","\\WSHSERVER2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("O:","\\staffshare1\departmentshares$\Officeshare\WSH","O Drive - Office Share")
    MapDrive ("P:","\\wshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\StuStore1\userdata$\HS\WSH","S Drive - Student Home Directories")
    MapDrive ("T:","\\StaffShare1\DepartmentShares$\TeacherShare\WSH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")    
Case INGroup ("WSH_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\WSH","H Drive - Netbaskets")
    MapDrive ("K:","\\WSHSERVER2\FATHOM$","K Drive - Fathom")
    MapDrive ("M:","\\app2\apps$\6-12\Math\Fathom 2","M Drive - Fathom 2")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps")
    MapDrive ("Z:","\\StuStore1\userdata$\HS\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("WSH_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\WSH","H Drive - Netbaskets")
    MapDrive ("M:","\\WSHSERVER2\apps$","M Drive - Apps")
    MapDrive ("N:","\\app2\apps$\6-12","N Drive - Apps K6-12")
    MapDrive ("Q:","\\AuxStorage\WSHPhoto$","Q Drive - Photos")
    MapDrive ("P:","\\wshserver2\pinnacle$","P Drive - Pinnacle")
    MapDrive ("S:","\\StuStore1\userdata$\HS\WSH","S Drive - Student Home Directories")
    MapDrive ("T:","\\StaffShare1\DepartmentShares$\TeacherShare\WSH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WSH\@USERID","Z Drive - @FULLNAME - Home Directory")

Case INGroup ("BL_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\BL","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\BL","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\BL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\BL\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("BL_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\BL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\BL\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("BL_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\BL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\BL","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\BL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\BL\@USERID","Z Drive - @FULLNAME - Home Directory")

Case INGroup ("CE_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\CE","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CE","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\CE","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CE\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("CE_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\CE","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\CE\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("CE_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\CE","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CE","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\CE","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CE\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("CK_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\CK","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CK","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\CK","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CK\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("CK_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\CK","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\CK\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("CK_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\CK","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CK","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\CK","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CK\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("CO_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\CO","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CO","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\CO","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CO\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("CO_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\CO","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\CO\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("CO_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\CO","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\CO","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\CO","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\CO\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("EA_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\EA","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\EA","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\EA","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\EA\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("EA_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\EA","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\EA\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("EA_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\EA","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\EA","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\EA","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\EA\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("IN_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\IN","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\IN","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\IN","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\IN\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("IN_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\IN","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\IN\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("IN_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\IN","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\IN","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\IN","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\IN\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("LL_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\LL","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\LL","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\LL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\LL\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("LL_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\LL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\LL\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("LL_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\LL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\LL","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\LL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\LL\@USERID","Z Drive - @FULLNAME - Home Directory")

Case INGroup ("MO_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\MO","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\MO","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\MO","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\MO\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("MO_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\MO","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\MO\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("MO_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\MO","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\MO","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\MO","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\MO\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("OM_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\OM","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\OM","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\OM","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\OM\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("OM_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\OM","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\OM\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("OM_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\OM","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\OM","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\OM","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\OM\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("SL_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\SL","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\SL","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\SL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\SL\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("SL_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\SL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\SL\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("SL_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\SL","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\SL","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\SL","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\SL\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("TH_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\TH","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\TH","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\TH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\TH\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("TH_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\TH","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\TH\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("TH_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\TH","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\TH","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\TH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\TH\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("WW_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\WW","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\WW","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\WW","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WW\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("WW_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\WW","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\WW\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("WW_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\WW","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\WW","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\WW","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WW\@USERID","Z Drive - @FULLNAME - Home Directory")
    
Case INGroup ("WH_Office")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("O:","\\staffshare1\Departmentshares$\OfficeShare\WH","O Drive - Office Share")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\WH","S Drive - Student Share")
    MapDrive ("T:","\\staffshare1\Departmentshares$\TeacherShare\WH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WH\@USERID","Z Drive - @FULLNAME - Home Directory")
Case INGroup ("WH_Students")
    MapDrive ("H:","\\StuStore1\Netbaskets\WH","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Students","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("Z:","\\StuStore1\Userdata$\EL\WH\@USERID","Z Drive - @FULLNAME -  Home Directory")
Case INGroup ("WH_Teachers")
    MapDrive ("H:","\\StuStore1\Netbaskets\WH","H Drive - Netbaskets")
    MapDrive ("M:","\\app2\K5-Staff","M Drive - Apps")
    MapDrive ("N:","\\app2\K5-Common","N Drive - Common Apps")
    MapDrive ("S:","\\StuStore1\Userdata$\EL\WH","S Drive - Student Share")
    MapDrive ("T:","\\Staffshare1\DepartmentShares$\TeacherShare\WH","T Drive - Teacher Share")
    MapDrive ("Z:","\\StaffStore1\Userdata$\WH\@USERID","Z Drive - @FULLNAME - Home Directory")

End Select

I used the command

Shell "\\wshdc\netlogon\TeacherLogs.exe"
to run my script

Thanks for your help everyone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...