## Extensive Login Script using KixTart, but will not run in Server 2012

## Extensive Login Script using KixTart, but will not run in Server 2012

(OP)

We are currently upgrading our Windows Servers from Windows Server 2003 to 2012 R2, we have been using KixTart for our login scripting, but I found out that it will not run in Server 2012 R2, and I don't want to maintain a couple of dozen Batch files, I am looking to use GPOs, but I was looking for a way to convert some of the following code to VBScript, but I'm have no luck finding Server Variable used in Active Directory

$Drive = "GHIKLOQR"

$SDrive = "STUVW"

DIM $Array[4,29]

$Array[1,0] = "ACCT"

$Array[2,0] = "Accounting"

$Array[1,1] = "CAD"

$Array[2,1] = "CAD"

$Array[1,2] = "CONS"

$Array[2,2] = "Consumer Relations"

$Array[1,3] = "CONT"

$Array[2,3] = "Contracts"

$Array[1,4] = "DIST"

$Array[2,4] = "Distribution"

$Array[1,5] = "DSC"

$Array[2,5] = "DSCGRP"

$Array[1,6] = "ENG"

$Array[2,6] = "Engineering"

$Array[1,7] = "EXEC"

$Array[2,7] = "Executives"

$Array[1,8] = "GSR"

$Array[2,8] = "GSRGRP"

$Array[1,9] = "HR"

$Array[2,9] = "Human Resources"

$Array[1,10] = "IMD"

$Array[2,10] = "Integrated Marketing"

$Array[1,11] = "LAB"

$Array[2,11] = "Engineering Lab"

$Array[1,12] = "MAINT"

$Array[2,12] = "MaintGRP"

$Array[1,13] = "MFG"

$Array[2,13] = "Manufacturing"

$Array[1,14] = "MIS"

$Array[2,14] = "MIS Department"

$Array[1,15] = "MKT"

$Array[2,15] = "MRKTGRP"

$Array[1,16] = "PROD"

$Array[2,16] = "Production"

$Array[1,17] = "PUR"

$Array[2,17] = "Purchasing"

$Array[1,18] = "QC"

$Array[2,18] = "Quality Control"

$Array[1,19] = "RECRUIT"

$Array[2,19] = "RECRUIT"

$Array[1,20] = "SADMIN"

$Array[2,20] = "SADMIN"

$Array[1,21] = "SALES"

$Array[2,21] = "SALESGRP"

$Array[1,22] = "SHIP"

$Array[2,22] = "Shipping"

$Array[1,23] = "SLABS"

$Array[2,23] = "SLABS"

$Array[1,24] = "SalesMrkt"

$Array[2,24] = "SalesMrkt"

$Array[1,25] = "Legal"

$Array[2,25] = "Legal"

$Array[1,26] = "JM"

$Array[2,26] = "JM"

$Array[1,27] = "Payroll"

$Array[2,27] = "Payroll"

$Array[1,28] = "Finance"

$Array[2,28] = "Finance"

$Array[1,29] = "Special "

$Array[2,29] = "Special "

$Letter=1

$SLetter=1

For $loop = 0 to 27

$Dept = $ARRAY[2,$loop]

$Group = $ARRAY[1,$loop]

$Dir = $ARRAY[1,$loop]

$Special = "Special "+$Array[1,$loop]

$Legal = $Array[1,$loop]

$Map = "\\DC01\Department\$Dir"

$DriveLetter = LTRIM(SUBSTR($Drive,$Letter,1))+":"

$SDriveLetter = LTRIM(SUBSTR($SDrive,$SLetter,1))+":"

If INGROUP("$Dept") >0

IF $Dept = "Contracts" and $DriveLetter = "G:"

$CONTLetter = "H:"

$Letter=$Letter+1

use $DriveLetter "$Map" ; Used for Legacy purposes

use H: $Map ; Special H: Drive map for Contract Build purposes

Else

use $DriveLetter "$Map"

endif

IF $Dept = "Accounting"

USE N: "\\DC01\Department\ACCT\Data"

endif

use $DriveLetter "$Map"

$Array[3,$loop] = "$DriveLetter"+"$Map"

$Letter=$Letter+1

IF $Dept = "DSC"

USE G: "\\DC01\Department\DSC"

endif

endif

If Ingroup("SBook") >0

Use K: "\\DC01\Department\Supervisors Book"

endif

If Ingroup("$Special") >0

use $SDriveletter "\\DC01\Special\$Group"

$Array[3,$loop] = "$SDriveLetter= "+"$Map"

$SLetter=$SLetter+1

Endif

If INGROUP("Special CAD") >0

use Z: "\\DC01\Encrypted"

Endif

If Ingroup("$Legal") >0

use $SDriveletter "\\DC01\Department\Legal"

$Array[3,$loop] = "$SDriveLetter= "+"$Map"

$SLetter=$SLetter+1

endif

Next

USE J: "\\DC01\Home\@userid"

USE M: "\\DC01\Public"

If INGROUP("UG_User") >0

Use L: "\\DC01\DATA"

Use N: "\\DC01\EDS"

Use O: "\\DC01\CAD_Data"

Use P: "\\DC01\UG_User"

Use Q: "\\DC01\UG_User\@userid"

Endif

If @userid = "HS"

Use L: "\\DC01\Department\CONT\Data\SHARED\Web"

Endif

If @userid = "KK"

Use K: "\\DC01\Home\KRONOS"

else

If @userid = "PC"

Use K: "\\DC01\Home\KRONOS"

Endif

Endif

If Ingroup("Recruit") >0

Use X: "\\DC01\Department\Recruit"

endif

SETTIME "\\DC01"

Exit

$Drive = "GHIKLOQR"

$SDrive = "STUVW"

DIM $Array[4,29]

$Array[1,0] = "ACCT"

$Array[2,0] = "Accounting"

$Array[1,1] = "CAD"

$Array[2,1] = "CAD"

$Array[1,2] = "CONS"

$Array[2,2] = "Consumer Relations"

$Array[1,3] = "CONT"

$Array[2,3] = "Contracts"

$Array[1,4] = "DIST"

$Array[2,4] = "Distribution"

$Array[1,5] = "DSC"

$Array[2,5] = "DSCGRP"

$Array[1,6] = "ENG"

$Array[2,6] = "Engineering"

$Array[1,7] = "EXEC"

$Array[2,7] = "Executives"

$Array[1,8] = "GSR"

$Array[2,8] = "GSRGRP"

$Array[1,9] = "HR"

$Array[2,9] = "Human Resources"

$Array[1,10] = "IMD"

$Array[2,10] = "Integrated Marketing"

$Array[1,11] = "LAB"

$Array[2,11] = "Engineering Lab"

$Array[1,12] = "MAINT"

$Array[2,12] = "MaintGRP"

$Array[1,13] = "MFG"

$Array[2,13] = "Manufacturing"

$Array[1,14] = "MIS"

$Array[2,14] = "MIS Department"

$Array[1,15] = "MKT"

$Array[2,15] = "MRKTGRP"

$Array[1,16] = "PROD"

$Array[2,16] = "Production"

$Array[1,17] = "PUR"

$Array[2,17] = "Purchasing"

$Array[1,18] = "QC"

$Array[2,18] = "Quality Control"

$Array[1,19] = "RECRUIT"

$Array[2,19] = "RECRUIT"

$Array[1,20] = "SADMIN"

$Array[2,20] = "SADMIN"

$Array[1,21] = "SALES"

$Array[2,21] = "SALESGRP"

$Array[1,22] = "SHIP"

$Array[2,22] = "Shipping"

$Array[1,23] = "SLABS"

$Array[2,23] = "SLABS"

$Array[1,24] = "SalesMrkt"

$Array[2,24] = "SalesMrkt"

$Array[1,25] = "Legal"

$Array[2,25] = "Legal"

$Array[1,26] = "JM"

$Array[2,26] = "JM"

$Array[1,27] = "Payroll"

$Array[2,27] = "Payroll"

$Array[1,28] = "Finance"

$Array[2,28] = "Finance"

$Array[1,29] = "Special "

$Array[2,29] = "Special "

$Letter=1

$SLetter=1

For $loop = 0 to 27

$Dept = $ARRAY[2,$loop]

$Group = $ARRAY[1,$loop]

$Dir = $ARRAY[1,$loop]

$Special = "Special "+$Array[1,$loop]

$Legal = $Array[1,$loop]

$Map = "\\DC01\Department\$Dir"

$DriveLetter = LTRIM(SUBSTR($Drive,$Letter,1))+":"

$SDriveLetter = LTRIM(SUBSTR($SDrive,$SLetter,1))+":"

If INGROUP("$Dept") >0

IF $Dept = "Contracts" and $DriveLetter = "G:"

$CONTLetter = "H:"

$Letter=$Letter+1

use $DriveLetter "$Map" ; Used for Legacy purposes

use H: $Map ; Special H: Drive map for Contract Build purposes

Else

use $DriveLetter "$Map"

endif

IF $Dept = "Accounting"

USE N: "\\DC01\Department\ACCT\Data"

endif

use $DriveLetter "$Map"

$Array[3,$loop] = "$DriveLetter"+"$Map"

$Letter=$Letter+1

IF $Dept = "DSC"

USE G: "\\DC01\Department\DSC"

endif

endif

If Ingroup("SBook") >0

Use K: "\\DC01\Department\Supervisors Book"

endif

If Ingroup("$Special") >0

use $SDriveletter "\\DC01\Special\$Group"

$Array[3,$loop] = "$SDriveLetter= "+"$Map"

$SLetter=$SLetter+1

Endif

If INGROUP("Special CAD") >0

use Z: "\\DC01\Encrypted"

Endif

If Ingroup("$Legal") >0

use $SDriveletter "\\DC01\Department\Legal"

$Array[3,$loop] = "$SDriveLetter= "+"$Map"

$SLetter=$SLetter+1

endif

Next

USE J: "\\DC01\Home\@userid"

USE M: "\\DC01\Public"

If INGROUP("UG_User") >0

Use L: "\\DC01\DATA"

Use N: "\\DC01\EDS"

Use O: "\\DC01\CAD_Data"

Use P: "\\DC01\UG_User"

Use Q: "\\DC01\UG_User\@userid"

Endif

If @userid = "HS"

Use L: "\\DC01\Department\CONT\Data\SHARED\Web"

Endif

If @userid = "KK"

Use K: "\\DC01\Home\KRONOS"

else

If @userid = "PC"

Use K: "\\DC01\Home\KRONOS"

Endif

Endif

If Ingroup("Recruit") >0

Use X: "\\DC01\Department\Recruit"

endif

SETTIME "\\DC01"

Exit