Tag: Active Directory

Command Line Cheat Sheet

Command Line Cheat Sheet

Some useful command lines:

Find which Logon Server

Echo %logonserver%

Find all Domain Controllers

Nltest /dclist:[Domain Name]

Machine Up Time:

systeminfo | find /i "Boot Time"

Some common run commands: Click Start > Run (or Windows key + R):

Accessibility Options                   access.cpl
Add New Hardware                     sysdm.cpl
Add/Remove Programs              appwiz.cpl
Date/Time Properties                 timedate.cpl
Display Properties                       desk.cpl
FindFast                                        findfast.cpl
Internet Properties                     inetcpl.cpl
Keyboard Properties                   main.cpl
Microsoft Exchange                    mlcfg32.cpl
Network Properties                     netcpl.cpl
Password Properties                   password.cpl
Regional Settings                         intl.cpl
System Properties                       sysdm.cpl
Device Manager                           Devmgmt.msc
Disk Management                       Diskmgmt.msc
AD Users & Computers              Dsa.msc

FTP command

ftp://username:password@media.thecloudcasting.com

Recycle Bin

start shell:RecycleBinFolder

Find Hidden Devices in Device Manager

Set  devmgr_show_nonpresent_devices=1

Find Hardware Spec of a PC

msinfo32

Active Directory

Ntdsutil.exe

Group Policy Update – no timeout

gpupdate /force /wait:-1

Boot to safe mode

Msconfig

Run as Admin

Runas /user:domain\Username cmd

Run any Command remotely

Winrs -r:PC1 ipconfig (or any command)

Disable Firewall remotely (this is deprecated in Server 2012)

Winrs -r:PC1 netsh firewall set opmode disable

Disable Firewall remotely Server 2012 +

Winrs -r:PC1 netsh advfirewall firewall set opmode disable

Get MAC address

Getmac -s

Disk Management

Diskpart.exe - disk management utility through CMD

Scan the integrity of all protected system files and replaces incorrect versions with correct Microsoft versions.
SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=] [/VERIFYFILE=]
[/OFFWINDIR= /OFFBOOTDIR=

sfc /scannow

Replicate Domain Controllers

Repadmin /replicate
Set AD Password with PowerShell

Set AD Password with PowerShell

Set a user’s Active Directory password using PowerShell

To set a AD password via PowerShell using plain text run the below PowerShell Command:

Set-ADAccountPassword –identity karchbol -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "1234" -Force)
Get AD Group and Members Of

Get AD Group and Members Of

Find members of an Active Directory Group

In order to retrieve a group and all of its members run the following in PowerShell. You will need the AD PowerShell module which is installed with RSAT.

Get-ADGroup -Filter 'groupcategory -eq "distribution"' |
#You can filter -eq distribution or security or *
     ForEach-Object{

          $hash=@{GroupName=$_.Name;Member=''}

          $_ | Get-ADGroupMember -ea 0 -recurs |

               ForEach-Object{

                    $hash.Member=$_.Name

                    New-Object psObject -Property $hash

               }

          } | 

     sort groupname,member | export-csv c:\group.csv