Advertisement
Advertisement
| 09.27.2008 at 08:27AM PDT, ID: 23768419 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: |
:: ===============
:: READ THIS FIRST
:: ===============
:: * This script require 'Computers.txt' file from where it will pick computer names and usernames.
:: * 'Computers.txt' file should be in following format
:: ComputerName:UserSAMAccountName
:: Like:
:: PC733:FKazi
:: * Copy and paste following script in notepad and save it with any name having .cmd extension.
:: *** SCRIPT START ***
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF NOT EXIST Computers.txt GOTO ShowErr
FOR %%R IN (Computers.txt) DO IF %%~zR EQU 0 GOTO ShowErr
IF EXIST CompMgr.ldf DEL /F /Q CompMgr.ldf
FOR /F "tokens=1-2 delims=:" %%a IN ('TYPE Computers.txt') Do (
ECHO Processing: %%a
SET ComputerDN=
SET UserDN=
DSQuery Computer -Name "%%a" |FIND /I "CN=">NUL
IF NOT ERRORLEVEL 1 (
DSQuery User -samID "%%b" |FIND /I "CN=">NUL
IF NOT ERRORLEVEL 1 (
FOR /F "delims=*" %%d IN ('DSQuery Computer -Name "%%a"') DO (SET ComputerDN=%%~d)
FOR /F "delims=*" %%d IN ('DSQuery User -samID "%%b"') DO (SET UserDN=%%~d)
( ECHO DN: !ComputerDN!
ECHO changetype: modify
ECHO replace: managedBy
ECHO managedBy: !UserDN!
ECHO -
ECHO.)>>CompMgr.ldf
) ELSE (ECHO *** ERROR *** %%b: User NOT Found in AD.)
) ELSE (ECHO *** ERROR *** %%a: Computer NOT Found in AD.))
ECHO.
IF EXIST CompMgr.ldf LDIFDE -I -K -F CompMgr.ldf
GOTO EndScript
:ShowErr
ECHO 'Computers.txt' file does not exist or file is empty!
:EndScript
IF EXIST CompMgr.ldf DEL /F /Q CompMgr.ldf
ENDLOCAL
:: *** SCRIPT END ***
|