User Tools

Site Tools


networking:windows:logon_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:windows:logon_script [2012/05/08 11:24]
gcooper
networking:windows:logon_script [2013/12/15 12:15] (current)
gcooper
Line 1: Line 1:
 ====== Login Scripts ====== ====== Login Scripts ======
 +
 +See also **[[networking:windows:logon_script_modular|Modular Logon Script]]**
  
 http://www.rlmueller.net/LogonScriptFAQ.htm http://www.rlmueller.net/LogonScriptFAQ.htm
Line 8: Line 10:
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
 +
 +http://pcloadletter.co.uk/2010/05/15/missing-network-drives/
  
 http://serverfault.com/questions/95379/why-wont-my-logon-scripts-map-drives-under-windows-7 http://serverfault.com/questions/95379/why-wont-my-logon-scripts-map-drives-under-windows-7
 +
 +http://social.technet.microsoft.com/Forums/en/w7itpronetworking/thread/0a7943b4-db41-443b-8ca5-9eea1db6b27a
  
 ===== Windows NT Method ===== ===== Windows NT Method =====
Line 24: Line 30:
   - Create or edit an existing Group Policy Object (GPO)   - Create or edit an existing Group Policy Object (GPO)
   - Right-click the GPO -> Edit   - Right-click the GPO -> Edit
 +
 +**User Configuration -> Policies -> Windows Settings -> Scripts -> Logon -> Properties -> Add**
  
 **User Configuration -> Policies -> Windows Settings -> Scripts -> Logon -> Properties -> Show Files** **User Configuration -> Policies -> Windows Settings -> Scripts -> Logon -> Properties -> Show Files**
  
-===== Groups and IDs =====+===== Run Commands Based on Workstation OS =====
  
-http://support.microsoft.com/kb/243330+:!: This needs testing and updating.
  
-http://networkadminkb.com/KB/a41/differences-between-authenticated-users-domain-users.aspx +To execute commands based on the host OS, you can create an include and use the following code:
- +
-http://ss64.com/nt/syntax-security_groups.html +
- +
-===== Modular Logon Script ===== +
- +
-{{ :networking:windows:modular_logon_assign.png?direct&400|}}Robb Dunn wrote this modular VBS logon script. +
- +
-Script: http://community.spiceworks.com/scripts/show/299 +
- +
-Howto: http://community.spiceworks.com/how_to/show/1189 +
- +
-==== Howto ==== +
- +
-  - Download and copy the logon.vbs file to the the appropriate folder on the domain controller where the script will be run. +
-    - Windows NT method +
-    - Group Policy method +
-  - Create two additional folders in the same directory called **'configs'** and **'includes'**. +
-  - Create a configuration file in the **'configs'** folder named **'global.conf'**. +
-  - Using either the Windows NT method or the Group Policy method, call the login script specifying the config file as an argument''logon.vbs config:global.conf'' +
-  - Use the detailed log files generated to troubleshoot and verify script execution.  +
- +
-=== Sample global.conf ===+
  
 <file> <file>
-<order> +If instr(lcase(sOSCaption),"windows 7") then 
-meta=1 +Call RunProcess("\\test\netlogon\exe\test.cmd",true) 
-drives=3 +ElseIf instr(lcase(sOSCaption),"windows xp") then 
-printers=2 +Call RunProcess("\\test\netlogon\exe\test.cmd",true) 
-processes=4 +End If 
-include=5 +</file>
-</order>+
  
-<meta> +===== Groups and IDs =====
-description=For all users +
-created=02/12/12 +
-author=Gene Cooper +
-</meta>+
  
-<drives> +http://support.microsoft.com/kb/243330
-m:\\WIN2008R2-PDC\company +
-p:\\WIN2008R2-PDC\users$\sUser  +
-t:\\WIN2008R2-PDC\test|group:testgroup +
-rem z:\\server\share +
-</drives>+
  
-<printers> +http://networkadminkb.com/KB/a41/differences-between-authenticated-users-domain-users.aspx
-\\WIN2008R2-PDC\pdfcreator;default +
-rem \\server\hpprinter|group:Print Users +
-rem \\server\colorprinter|-group:domain users|group:Colorprint Users +
-rem \\server\faxprinter|ip:192.168.0.23 +
-</printers>+
  
-<processes> +http://ss64.com/nt/syntax-security_groups.html
-rem c:\windows\write.exe +
-</processes> +
- +
-<include> +
-rem File1.inc +
-rem File2.inc|computerOU:OU=test,OU=domain computers +
-rem File3.inc|group:marketing +
-</include> +
-</file> +
- +
-==== Troubleshooting ==== +
- +
-**Start -> Run -> %temp%** +
- +
-  * Look for logon_<your-conf-file>.log for login details. +
-  * If you don’t see the logfile here, then you know that the script did NOT run.+
  
 ===== Sample Logon Scripts ===== ===== Sample Logon Scripts =====
Line 267: Line 222:
 ==== Determine Workstation OS ==== ==== Determine Workstation OS ====
  
-=== Batch File Method ===+http://www.grimadmin.com/article.php/batchfile-easy-way-to-detect-os-version 
 + 
 +=== Batch File Method 1 === 
 + 
 +<file> 
 +@ECHO off 
 +SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION 
 + 
 +FOR /f "tokens=1,2* delims=." %%a IN ('ver') DO ( 
 + 
 +SET WVer=%%a 
 +SET WVer=!WVer:~-1! 
 +SET WVer=!WVer!.%%b.%%c 
 +SET WVer=!WVer:]=! 
 +
 + 
 +IF DEFINED ProgramFiles(x86) ( 
 +SET OSBit=x64 
 +) ELSE ( 
 +SET OSBit=x86 
 +
 + 
 +ECHO %WVer% %OSBit% 
 +</file> 
 + 
 +=== Batch File Method 2 ===
  
 <file> <file>
networking/windows/logon_script.1336497874.txt.gz · Last modified: 2012/05/08 11:24 by gcooper