Powershell Network Commands Cheat Sheet

This is the ultimate collection of PowerShell commands for Active Directory, Office 365, Windows Server and more.

These commands will help with numerous tasks and make your life easier.

Table of Contents:

Active Directory PowerShell Commands

View all Active Directory commands

This cheat sheet will be updated when Microsoft releases new information throughout PowerShell’s development lifecycle. PowerShell includes commands called cmdlets that add functionality to the core foundation, while providing a means to upgrade/update cmdlets to further augment functionality in the future versions.

  • Windows Server 2019 & PowerShell All-in-One For Dummies Cheat Sheet. PowerShell 5.1 is the current released version of Windows PowerShell and is the version that ships with Windows Server 2016 and Windows Server 2019. It is installed by default on these newer operating systems, but it’s also available for install on Windows Server 2008 R2.
  • Creating PowerShell Command Cheat Sheets (Part 2) - Power Tips - Power Tips - IDERA Community. In the previous tip, we created cheat sheets for PowerShell commands, and as a reminder, this line would create a sheet for network commands (provided you have access to the NetAdapter module that was browsed in this example): PS Get-Command -Module.

Display Basic Domain Information

Get all Domain Controllers by Hostname and Operating

Get all Fine Grained Password Policies

Get Domain Default Password Policy

Gets the password policy from the logged in domain

Backup Active Directory System State Remotely

This will back up the domain controllers system state data. Change DC-Name to your server name and change the Backup-Path. The backup path can be a local disk or a UNC path

AD User PowerShell Commands

This section is all Active Directory user commands

Get User and List All Properties (attributes)

Change username to the samAccountName of the account

Get User and List Specific Properties

Just add whatever you want to display after select

Get All Active Directory Users in Domain

Get All Users From a Specific OU

OU = the distinguished path of the OU

Get AD Users by Name

This command will find all users that have the word robert in the name. Just change robert to the word you want to search for.

Get All Disable User Accounts

Disable User Account

Enable User Account

Get All Accounts with Password Set to Never Expire

Find All Locked User Accounts

Unlock User Account

List all Disabled User Accounts

Force Password Change at Next Login

Move a Single User to a New OU

You will need the distinguishedName of the user and the target OU

Move Users to an OU from a CSV

Setup a csv with a name field and a list of the users sAmAccountNames. Then just change the target OU path.

AD Group Commands

Get All members Of A Security group

Get All Security Groups

This will list all security groups in a domain

Add User to Group

Change group-name to the AD group you want to add users to

Export Users From a Group

This will export group members to a CSV, change group-name to the group you want to export.

Get Group by keyword

Find a group by keyword. Helpful if you are not sure of the name, change group-name.

Import a List of Users to a Group

AD Computer Commands

Get All Computers

This will list all computers in the domain

Get All Computers by Name

This will list all the computers in the domain and only display the hostname

Get All Computers from an OU

Get a Count of All Computers in Domain

Get all Windows 10 Computers

Change Windows 10 to any OS you want to search for

Get a Count of All computers by Operating System

This will provide a count of all computers and group them by the operating system. A great command to give you a quick inventory of computers in AD.

Delete a single Computer

Delete a List of Computer Accounts

Add the hostnames to a text file and run the command below.

Powershell network commands cheat sheet printable

Delete Computers From an OU

Powershell Network Commands Cheat Sheet Download

Group Policy Section

Get all GPO related commands

Get all GPOs by status

Backup all GPOs in the Domain

Office 365 PowerShell Commands

Connect To Exchange Online

This will pop up and ask for credentials

Force Azure Sync

This is for the azure ad sync client.

Marrying my cowboy pdf free download torrent

Force delta sync (only sync changes

Get A List of All Office 365 Users

Get Full mailbox details

Get Calendar Permissions

Enable Remote Mailbox (Hybrid Environment)

Use this command if you have an existing on-premise user that needs an office 365 mailbox. There are other ways to do this but this creates all the attributes in the AD account.

Replace the username and the tenant fields

Windows Server & Client Commands

Get all Services

Get all Processes

Windows powershell commands cheat sheet

Display Network Adapters

Gets detailed about the network adapter installed such as name, status, speed and mac address.

Powershell Cheat Sheet Pdf

Restart Remote Computers

Get Last Boot Time

This takes a few lines

You can also run this single line to get last boot time

Start a Remote Session

Use this to start an interactive session with a remote computer

Read the Content of a File (Open a file)

This example shows how to read the content of the windows firewall log file

Copy Files & Folders

Use this command to copy an entire folder to another folder. This will copy the folder and all the sub folder/files. The -verbose command will display the results to the console.

Basic PowerShell Commands

Get Execution Policy

Set Execution Policy to Unrestricted

Show PowerShell Version

Get help for a command

Use this to get the help information for a command

Search Get Help

Use this to search the help files. This is useful if you don’t know the command or want to see if one exists.

Get Installed Modules

Use this command to display all the installed modules on a computer

List All Available Modules

This will list all available modules on the computer.

Exporting results to CSV

Add export-csv to the end of commands

Display available commands

Powershell Command Cheat Sheet Printable

This will display all commands that are available based on the modules that are loaded.

Find New Modules

Replace *ntfs* with the keyword you want to search for. This searches modules at https://www.powershellgallery.com/

Powershell 7 Cheat Sheet

Install a New Module

Installs modules from https://www.powershellgallery.com/

I found a module called NTFSSecurity, to install it I run this command

Powershell Command Cheat Sheet Pdf

Recommended Tool: SolarWinds Server & Application Monitor

This utility was designed to Monitor Active Directory and other critical services like DNS & DHCP. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.

Powershell Network Commands Cheat Sheet Pdf

What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.