This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
networking:windows:logon_script [2012/05/08 11:28] gcooper |
networking:windows:logon_script [2013/12/15 12:15] (current) gcooper |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Login Scripts ====== | ====== Login Scripts ====== | ||
+ | |||
+ | See also **[[networking: | ||
http:// | http:// | ||
Line 28: | 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:// | + | :!: This needs testing and updating. |
- | http:// | + | To execute commands based on the host OS, you can create an include |
- | + | ||
- | http:// | + | |
- | + | ||
- | ===== Modular Logon Script ===== | + | |
- | + | ||
- | {{ : | + | |
- | + | ||
- | Script: http:// | + | |
- | + | ||
- | Howto: http:// | + | |
- | + | ||
- | ==== Howto ==== | + | |
- | + | ||
- | - Download and copy the logon.vbs file to the the appropriate folder | + | |
- | - Windows NT method | + | |
- | - Group Policy method | + | |
- | - Create two additional folders in the same directory called **' | + | |
- | - Create a configuration file in the **' | + | |
- | - Using either the Windows NT method or the Group Policy method, call the login script specifying the config file as an argument: '' | + | |
- | - Use the detailed log files generated to troubleshoot and verify script execution. | + | |
- | + | ||
- | === Sample global.conf === | + | |
< | < | ||
- | < | + | If instr(lcase(sOSCaption)," |
- | meta=1 | + | Call RunProcess(" |
- | drives=3 | + | ElseIf instr(lcase(sOSCaption)," |
- | printers=2 | + | Call RunProcess(" |
- | processes=4 | + | End If |
- | include=5 | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | description=For all users | + | |
- | created=02/ | + | |
- | author=Gene Cooper | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | m:\\WIN2008R2-PDC\company | + | |
- | p:\\WIN2008R2-PDC\users$\sUser | + | |
- | t: | + | |
- | rem z: | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | \\WIN2008R2-PDC\pdfcreator; | + | |
- | rem \\server\hpprinter|group: | + | |
- | rem \\server\colorprinter|-group: | + | |
- | rem \\server\faxprinter|ip: | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | rem c: | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | rem File1.inc | + | |
- | rem File2.inc|computerOU: | + | |
- | rem File3.inc|group: | + | |
- | </ | + | |
</ | </ | ||
- | ==== Troubleshooting | + | ===== Groups and IDs ===== |
- | **Start -> Run -> %temp%** | + | http:// |
- | * Look for logon_< | + | http:// |
- | * If you don’t see the logfile here, then you know that the script did NOT run. | + | |
+ | http:// | ||
===== Sample Logon Scripts ===== | ===== Sample Logon Scripts ===== | ||
Line 271: | Line 222: | ||
==== Determine Workstation OS ==== | ==== Determine Workstation OS ==== | ||
- | === Batch File Method === | + | http:// |
+ | |||
+ | === Batch File Method | ||
+ | |||
+ | < | ||
+ | @ECHO off | ||
+ | SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION | ||
+ | |||
+ | FOR /f " | ||
+ | |||
+ | SET WVer=%%a | ||
+ | SET WVer=!WVer: | ||
+ | SET WVer=!WVer!.%%b.%%c | ||
+ | SET WVer=!WVer: | ||
+ | ) | ||
+ | |||
+ | IF DEFINED ProgramFiles(x86) ( | ||
+ | SET OSBit=x64 | ||
+ | ) ELSE ( | ||
+ | SET OSBit=x86 | ||
+ | ) | ||
+ | |||
+ | ECHO %WVer% %OSBit% | ||
+ | </ | ||
+ | |||
+ | === Batch File Method 2 === | ||
< | < |