dsquery examples

dsquery * ou=users,dc=top1,dc=domain,dc=com -attr department -limit 10000

dsquery * domainroot -filter "(|((|(&(objectClass=User)(proxyAddresses=*@iacny.com*))(&(objectClass=User)(proxyAddresses=*@crousemed.com*))))(|((&(objectClass=User)(physicaldeliveryofficename=*Internist Assoc CNY*)))((&(objectClass=User)(physicaldeliveryofficename=*CMP*)))))" -attr name mail sAMAccountName distinguishedName userAccountControl -limit 1000


REM Members of an OU

dsquery * "ou=Dashboard External Users,DC=snet,DC=crouse,DC=org" -attr sAMAccountName -limit 10000


REM Members of an OU that are *not* disabled

dsquery * "ou=Dashboard External Users,DC=snet,DC=crouse,DC=org" -filter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -attr sAMAccountName -limit 10000

 

Event Log Query from Command Line

REM USER32 entry

WEVTUtil query-events System /count:1 /rd:true /format:text /q:"Event[System[(EventID=1074)]]"


REM Eventlog up ## seconds

WEVTUtil query-events System /count:1 /rd:true /format:text /q:"Event[System[(EventID=6013)]]"


REM EventLog Started

WEVTUtil query-events System /count:1 /rd:true /format:text /q:"Event[System[(EventID=6005)]]"

Import picture into AD with PS

# 96x96, all attributes removed. Has to be under 10K


[PS] C:\>Import-RecipientDataProperty -Identity "Rich Lemmermann" -Picture -FileData ([Byte[]]$(Get-Content -Path "c:\rich.jpg" -Encoding Byte -ReadCount 0))



Author

#Reference:

#http://blogs.technet.com/b/exchange/archive/2010/03/10/3409495.aspx

 

Set proxy globally on PC

Using netsh

netsh winhttp set proxy <proxy server address> <exception list in quotes, seperated by ;>

 

Using reg.exe


C:\Windows\System32\reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f