vbscript logon script

Our old logon script from 2002

'****************************************************************
'* Logon Script 2k      *
'* This should be the end to multiple logon scripts *
'* This will be the logon script for all labs.  *
'* ps. Nothing is a cure all.    *
'* Its written in vbscript http://msdn.microsoft.com *
'*        *
'* Stephen@2k2     *
'* Edited by:      *
'*  Robert *  
'*      and                                         *
'*  Mike *
'****************************************************************

'Date Modified Feb 6, 2002
On error resume next
Dim WshNetwork, WshSHell, Return, Desktop, HKCU
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("Wscript.Shell")
Desktop=WshShell.SpecialFolders("Desktop")
username=left(WshNetwork.Computername,3)
dim number

'Novell Drive Mappings.
call winmap("l:","\\Thurston_w\vol1","lab")

'return=WshShell.run ("subst p: /d", 0, true) 
'return=WshShell.run("subst p: c:\temp", 0, true)

'Citrix Applications
call shortcut("CITRIX APPS","%userprofile%\application data\icaclient\CITRIX APPS.lnk","C:\Program Files\Internet Explorer\")

'Just put your commands for what lab ur in.
Select Case username
Case "PUB"
 Wshnetwork.addwindowsprinterconnection("\\ginger\pub4000")
 Wshnetwork.setdefaultprinter("\\ginger\pub4000")
 If right(WSHNetwork.Computername,2) <> 30 Then
  Wshnetwork.addwindowsprinterconnection("\\ginger\puboki8")
 End if
 call winmap("n:","\\ginger\shared","lab")
 Call shortcut("Paint Shop Pro","L:\XPAPPS\Paint Shop Pro\Psp.exe","L:\XPAPPS\Paint Shop Pro")
Case "MHK"
 Wshnetwork.addwindowsprinterconnection("\\ginger\mhk5m")
 wshnetwork.setdefaultprinter("\\ginger\mhk5m")
 call winmap("n:","\\ginger\shared","lab")
Case "NUR"
 Wshnetwork.addwindowsprinterconnection("\\ginger\nur4000")
 wshnetwork.setdefaultprinter("\\ginger\nur4000")
 call winmap("n:","\\ginger\shared","lab")
 call shortcut("Inventor","C:\Program Files\Autodesk\Inventor 5.3\Bin\Inventor.exe","C:\Program Files\Autodesk\Inventor 5.3\Bin")
Case "BPM"
 Wshnetwork.addwindowsprinterconnection("\\ginger\bpm4000")
 wshnetwork.setdefaultprinter("\\ginger\bpm4000")
 If right(WSHNetwork.Computername,2) < number =" right(WshNetwork.Computername,2)" number = "03"> 32 Then
  Wshnetwork.addwindowsprinterconnection("\\ginger\don4000")
 End if
Case "LRN"
 Wshnetwork.addwindowsprinterconnection("\\ginger\lrn4000")
 Wshnetwork.setdefaultprinter("\\ginger\lrn4000")
 call winmap("n:","\\ginger\shared","lab") 
 call shortcut("EVE 2","C:\Program Files\EVE2\eve2.exe","C:\Program Files\EVE2")
 call shortcut("SPSS11","C:\Program Files\SPSS\spsswin.exe","C:\Program Files\SPSS")
Case "DON"
 Wshnetwork.addwindowsprinterconnection("\\ginger\don4000")
 Wshnetwork.setdefaultprinter("\\ginger\don4000")
 If right(WSHNetwork.Computername,2) <> 25 Then
  Wshnetwork.addwindowsprinterconnection("\\ginger\dtp4M")
  Wshsetdefaultprinter("\\ginger\dtp4M")
 End if 
 call winmap("n:","\\ginger\shared",username)
 call shortcut("Quark Xpress","L:\XPAPPS\QuarkXPress\QuarkXPress Passport.exe","L:\XPAPPS\QuarkXPress\QuarkXPress Passport.exe")
 call shortcut("SHARED","N:\SHARE2147\","N:\SHARE2147\")
 call shortcut("PAGEMAKER","C:\Program Files\Adobe\PageMaker 7.0\Pm70.exe","C:\Program Files\Adobe\PageMaker 7.0")
 call shortcut("PHOTOSHOP","C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe","C:\Program Files\Adobe\Photoshop 7.0")
 call shortcut("SPSS11","C:\Program Files\SPSS\spsswin.exe","C:\Program Files\SPSS") 
 Call shortcut("Paint Shop Pro","L:\XPAPPS\Paint Shop Pro\Psp.exe","L:\XPAPPS\Paint Shop Pro")
 call shortcut("EVE","%userprofile%\application data\icaclient\EVE2.lnk","c:\program files\citrix\ica client\")
Case "CAD"
 Wshnetwork.addwindowsprinterconnection("\\ginger\cad4000")
 wshnetwork.setdefaultprinter("\\ginger\cad4000")
 Wshnetwork.addwindowsprinterconnection("\\ginger\cad700")
 
 If right(WSHNetwork.Computername,2) > 6 Then
  Call shortcut("DB UNLOCK","C:\Program Files\Manufacturers Technologies\Costimator\DbUnlock.exe","C:\Program Files\Manufacturers Technologies\Costimator\")
  Call shortcut("COSTIMATOR","C:\Program Files\Manufacturers Technologies\Costimator\MTIMain.exe","C:\Program Files\Manufacturers Technologies\Costimator\")
 End if
 call winmap("n:","\\ginger\shared","lab")
 Call shortcut("POM","C:\program files\POMwin32\pom32start.exe","C:\program files\POMwin32\pom32start.exe")
 Call shortcut("Solidworks","C:\program files\solidworks\sldworks.exe","C:\program files\solidworks\")
Case "PHY"
 Wshnetwork.addwindowsprinterconnection("\\ginger\phy4000")
 wshnetwork.setdefaultprinter("\\ginger\phy4000")
 'G: Drive for the Genetics program
 call winmap("g:","\\island\dfs\vol1\xpapps\genetics","lab")
 'genetics software needs diff to run diff is called karyo.exe
 call shortcut("Karyotypes","L:\XPAPPS\GENETICSa\karyopw.exe","L:\XPAPPS\GENETICSa")
 call shortcut("Sky","C:\Program Files\Software Bisque\TheSky\SKY.exe","C:\Program Files\Software Bisque\TheSky")
 call shortcut("Genetics","L:\XPAPPS\GENETICS\Genetics\Start Genetics.exe","L:\XPAPPS\GENETICS\genetics")
 call winmap("n:","\\ginger\shared","lab")
 call shortcut("SHARED","N:\SHARE2107\","N:\SHARE2107\")
Case Else
End Select
'************************************************************************************************************
'*                                             FUNCTIONS          *
'************************************************************************************************************
Function unmap(drv)
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  If fso.DriveExists(drv) Then WshNetwork.removeNetworkDrive drv & ":"
End Function

Function winmap(drive,dest,user)
unmap(drive)
Wshnetwork.mapnetworkdrive drive, dest, false, user, ""
End Function

Function shortcut(name,dest,working)
Set shelllink = wshshell.createshortcut(desktop & "\" & name &".lnk")
shelllink.targetpath= dest
shelllink.workingdirectory= working
shelllink.windowstyle = 1
shelllink.save
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.