Loginscript Bits & Pieces

This a collection loginscript pieces that i have found useful… more will come

Mapping Drives

Use “*” /delete

Mapping Drives for Groups

If InGroup (“Domain Admins”)
  Use i: \servershare
EndIf

If InGroup (“Group”)
  Use r: “\servershare2”
EndIf

Mapping Printers

Delete Printer Connections

DelTree(“HKEY_CURRENT_USERPrintersconnections”)

Map Printer Connections

ADDPRINTERCONNECTION (“\ServerPrinter”)

Networking

Adding Routes

RUN “Route add 10.0.0.0 mask 255.255.255.0 192.168.0.1”

Find out which subnet the user is on:

if Left(@ipaddress0,11) = ” 10.  0.  0″    ;DONT REMOVE SPACES!!!!!!
 $Country=”Subnet 1″
Endif
if Left(@ipaddress0,11) = ” 10.  0.  1″    ;DONT REMOVE SPACES!!!!!!
 $Country=”Subnet 2″
EndIf
if Left(@ipaddress0,11) = ” 10.  0. 02″    ;DONT REMOVE SPACES!!!!!!
 $Country=”Subnet 3″
EndIf
if Left(@ipaddress0,11) = ” 10.  0. 03″    ;DONT REMOVE SPACES!!!!!!
 $Country=”Subnet 4″
EndIf

Note: The Spaces are very important !!!!

Copy files to the computer at login

copy “\serverinstallvpnlogonLoginVPN.*” “C:Documents and SettingsAll UsersStart-meny”

Application Settings

Lotus Notes Settings

IF INGROUP(“Citrix Domino Users”)
 AT (16,21) “Skapar Notes katalog för Citrix”
 IF EXIST (H:Lotus)
 
 ELSE
  md H:Lotus
  md H:LotusNotesdata
  copy “G:TOOLSSDKSCXNotesdata*.*” “H:LotusNotesdata”
  copy “G:TOOLSSDKSCXnotes.ini” “H:Lotus”
 ENDIF
ENDIF

Backing Up Important Notesfiles

AT (16,21) “Creating backup of important Notes Files”
copy “c:lotusnotesdata*.id” “c:lotusnotesdata*.idbak”
copy “c:lotusnotesdatanames.nsf” “c:lotusnotesdatanames.nsfbak”
copy “c:lotusnotesdatabookmark.nsf” “c:lotusnotesdatabookmark.nsfbak”
copy “c:lotusnotesdatadesktop5.dsk” “c:lotusnotesdatadesktop5.dskbak”

Configure Office MultiLanguage Pack (sv,no,dk)

$result=AddKey(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”1033″, “On”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”2057″, “On”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”1053″, “On”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”1030″, “On”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”1044″, “On”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”2068″, “On”, “REG_SZ”)

; Configure Office MultiLanguage Pack (UI,HELP)

$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”UILanguage”, “409”, “REG_DWORD”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonLanguageResources”,”HelpLanguage”, “409”, “REG_DWORD”)

Internet Explorer

Setup Homepage Settings in Internet Explorer

$result=WRITEVALUE(“HKEY_CURRENT_USERSoftwareMicrosoftInternetExplorerMain”, “Start Page”, http://www.johanpersson.nu, “REG_SZ”)

Setup Proxy Settings in Internet Explorer

$result=AddKey(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings”,”ProxyServer”, “10.0.0.1:8080”, “REG_SZ”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings”,”ProxyEnable”, “00000001”, “REG_DWORD”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings”,”ProxyOverride”, “<local>”, “REG_SZ”)

Setting Size of Temprary Internet files

$result=WRITEVALUE(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet SettingsCache”,”Persistent”,”0″,”REG_DWORD”)
$result=WRITEVALUE(“HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionInternet Settings5.0CacheContent”,”CacheLimit”,”20480″,”REG_DWORD”)
$result=WRITEVALUE(“HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionInternet SettingsCacheContent”,”CacheLimit”,”20480″,”REG_DWORD”)

Delete Temporary Internet Files

AT (4,1) “Deleting Temp Files for IE on Dagmar…”
DEL “C:Documents and Settings” + @USERID + “Local SettingsTemporary Internet Files*.*” /c /f /h /s

IBM Client Access

Setup AS/400 Connections

$result=AddKey(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 Connections”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 Connections”,”Default System”, “address“, “REG_SZ”)
$result=AddKey(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 ConnectionsServerCommunication”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 ConnectionsserverCommunication”,”User ID”,@userid , “REG_SZ”) $result=WriteValue(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 ConnectionsServerCommunication”,”Signon Mode”,”00000001″ , “REG_DWORD”) $result=WriteValue(“HKEY_CURRENT_USERSoftwareIBMClient Access ExpressCurrentVersionEnvironmentsMy AS/400 ConnectionsServerCommunication”,”IP Address”,”adress” , “REG_SZ”)

Client Backup

Installing Symantes DLO

if EXISTKEY(“HKEY_LOCAL_MACHINESOFTWAREVERITASDLOClientUserShare”)<>0
   AT (16,21) “Installing DLO…                    “
   SHELL “%COMSPEC% /e:1024 /c \DLOSERVERdloagentsetup.exe /settings \DLOSERVERdloagentsetup.ini
Endif

Changing DLO Server on Client

$DLO = ReadValue (“HKEY_CURRENT_USERSoftwareLogin”,”DLO”)

IF $DLO<>1
   WriteValue(“HKEY_CURRENT_USERSOFTWAREVERITASDLOClient”,”DefaultMediaServer”, “DLOSERVER”, “REG_SZ”)
   WriteValue(“HKEY_LOCAL_MACHINESOFTWAREVERITASDLOClient”,”DefaultMediaServer”, “DLOSERVER”, “REG_SZ”)

   WriteValue(“HKEY_CURRENT_USERSoftwareLogin”,”DLO”, “1”, “REG_SZ”)
ENDIF

Antivirus Software

Installing Symantec Antivirus Corporate Edition

If Exist(“C:Documents and SettingsAll UsersApplication DataSymantecSymantec AntiVirus Corporate Edition7.5”)<>1
 AT (16,21) “Antivirus Not Installed…              “
 ; msiexec.exe /i \AVSERVERVPHOMECLT-INSTWIN32SAV10.msi REBOOT=ReallySuppress INSTALLSERVER=0 NETWORKTYPE=1 SERVERNAME=GIS RUNLIVEUPDATE=0 ADDLOCAL=SAVMain,SAVUI,SAVHelp,QClient /qb!
EndIf

Changing AV Server on Client

$AV = ReadValue (“HKEY_CURRENT_USERSoftwareLogin”,”AV”)

IF $AV<>1
   AT (16,21) “Migrating Symantec Antivirus…         “
   copy “\dcclappl02VPHOMEGroupsComputersGRC.DAT” “C:Documents and SettingsAll UsersApplication DataSymantecSymantec AntiVirus Corporate Edition7.5”
   WriteValue(“HKEY_CURRENT_USERSoftwareLogin”,”AV”, “2”, “REG_SZ”)
Endif

Misc Windows Stuff

Starting application in new window (in this case installing trend antivirus)

shell “%COMSPEC% /c start /SEPARATE \serverofcscanautopcc”

Reading from registry

$Key = ReadValue (“HKEY_CURRENT_USERSoftwareFolder”,”Key”)

IF $OTLK<>0
   ;Do This
ENDIF

Copy Files to Desktop at logon with versioncontrol

$ASCOP = ReadValue (“HKEY_CURRENT_USERSoftwareSysteam”,”ASCOP”)

IF $ASCOP<>3
   Shell “%comspec% /c Copy \servershare*.* c:folder”
   WriteValue(“HKEY_CURRENT_USERSoftwareSysteam”,”ASCOP”, “3”, “REG_SZ”)
ENDIF

Logoff Users At First Login

$USROFF = ReadValue (“HKEY_CURRENT_USERSoftwareSysteam”,”USROFF”)

IF $USROFF<>2
   $RC = LogOff(1) 
   WriteValue(“HKEY_CURRENT_USERSoftwareSysteam”,”USROFF”, “2”, “REG_SZ”)
ENDIF

Setup Folder Redirection

; My Documents

$result=AddKey(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders”,”Personal”, “\serverUsers%USERNAME%”,”REG_EXPAND_SZ”)

; Desktop

if EXIST (“\server%USERNAME%desktop”) GOTO DESKTOP
 MD \server%USERNAME%desktop
ENDIF

:DESKTOP
$result=AddKey(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders”)
$result=WriteValue(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders”,”Desktop”, “\serverUsers%USERNAME%desktop”, “REG_EXPAND_SZ”)

 

 

 

Leave a Reply

%d bloggers like this: