Show full IP configuration
See IP address, gateway, DNS servers and DHCP details for every adapter.
ipconfig /allCopy-ready PowerShell commands for networking, Active Directory, Exchange Online, Windows and more. Curated by Zenith Services Inc. (ZSI).
These are PowerShell commands our team uses for everyday troubleshooting and administration. Search or pick a category, press Copy, then replace anything in <angle brackets> with your own value. Green means read-only, and orange means the command makes changes.
Looking for downloads and sign-in pages? See our IT tools and support links.
See IP address, gateway, DNS servers and DHCP details for every adapter.
ipconfig /allClear cached DNS answers after a DNS or web filter change.
ipconfig /flushdnsRelease and request a new IP address from DHCP.
ipconfig /release
ipconfig /renewCheck which DNS server answers and what address it returns.
nslookup <host.example.com>Compare your internal DNS answer with a public resolver.
nslookup <host.example.com> 1.1.1.1Check whether a remote host accepts connections on a port, such as 3389 for RDP.
Test-NetConnection <HostName> -Port <Port>See each network hop on the way to an address.
tracert 8.8.8.8Show adapter status, link speed and driver version.
Get-NetAdapter | Format-Table Name,InterfaceDescription,Status,LinkSpeed,DriverVersion -AutoSizeFind adapters that Windows may turn off to save power. Some adapters do not support this and show an error.
Get-NetAdapterPowerManagement | Format-Table Name,AllowComputerToTurnOffDevice,SelectiveSuspend,DeviceSleepOnDisconnect -AutoSizeSee the band, channel, signal and receive rate of the current Wi-Fi connection.
netsh wlan show interfacesShow the process listening on a local TCP port.
Get-NetTCPConnection -LocalPort <Port> -State Listen | ForEach-Object { Get-Process -Id $_.OwningProcess }Confirm the PC can find a domain controller for the domain.
nltest /dsgetdc:<ad.example.com>Check a user account name and UPN.
Get-ADUser <UserName> | Select-Object SamAccountName,UserPrincipalNameGet a quick total of user accounts in the domain.
Get-ADUser -Filter * | Measure-ObjectSet the sign-in name, for example to match Microsoft 365.
Set-ADUser <UserName> -UserPrincipalName <UserName>@<example.com>See the groups a user belongs to.
(Get-ADPrincipalGroupMembership <UserName>).NameGive a new user the same groups as an existing user.
(Get-ADUser <ExistingUser> -Properties MemberOf).MemberOf | ForEach-Object { Add-ADGroupMember -Identity $_ -Members <NewUser> }Show the name of every computer account.
Get-ADComputer -Filter * | Select-Object NameConfirm a computer account has not been disabled.
(Get-ADComputer <ComputerName>).EnabledJoin the domain, set a new name and restart. It asks for domain admin credentials.
Add-Computer -DomainName <ad.example.com> -NewName <NewComputerName> -Credential (Get-Credential) -RestartRename this PC and restart it.
Rename-Computer -NewName <NewComputerName> -RestartApply the latest Group Policy settings now.
gpupdate /forceList the computer policies that reached this PC.
gpresult /r /scope computerKerberos sign-in can fail when clocks differ by more than 5 minutes.
w32tm /query /source
w32tm /query /statusShow the sign-in name Windows is using.
whoami /upnSee whether a PC is joined to Entra ID, workplace joined or domain joined.
dsregcmd /status | Select-String 'AzureAdJoined|WorkplaceJoined|DomainJoined|TenantName'Install the Microsoft Graph sign-in module for your account.
Install-Module Microsoft.Graph.Authentication -Scope CurrentUserSign in to Graph with the permissions you need.
Connect-MgGraph -Scopes 'User.Read.All' -NoWelcomeSee which account and permissions the session is using.
Get-MgContextInstall the module for your account.
Install-Module ExchangeOnlineManagement -Scope CurrentUserSign in with an admin account.
Connect-ExchangeOnline -UserPrincipalName <admin@example.com> -ShowBanner:$falseSave mailbox type and forwarding settings to a file.
Get-EXOMailbox -ResultSize Unlimited -Properties RecipientTypeDetails,ForwardingAddress,ForwardingSmtpAddress | Select-Object DisplayName,PrimarySmtpAddress,RecipientTypeDetails,ForwardingAddress,ForwardingSmtpAddress | Export-Csv .\Mailboxes.csv -NoTypeInformationSee item count and total size for one mailbox.
Get-MailboxStatistics -Identity <user@example.com> | Select-Object DisplayName,ItemCount,TotalItemSizeSee whether a mailbox forwards email elsewhere.
Get-Mailbox <user@example.com> | Format-List RecipientTypeDetails,ForwardingAddress,ForwardingSmtpAddress,DeliverToMailboxAndForwardUseful when you suspect a compromised mailbox.
Get-InboxRule -Mailbox <user@example.com> | Where-Object { $_.ForwardTo -or $_.ForwardAsAttachmentTo -or $_.RedirectTo } | Select-Object Name,Enabled,ForwardTo,RedirectToShow delegates, without the built-in system accounts.
Get-MailboxPermission <user@example.com> | Where-Object { $_.User -notlike 'NT AUTHORITY*' } | Format-Table User,AccessRightsLet a user open a shared or delegated mailbox.
Add-MailboxPermission -Identity <shared@example.com> -User <user@example.com> -AccessRights FullAccess -InheritanceType AllLet a user send email as a shared mailbox.
Add-RecipientPermission -Identity <shared@example.com> -Trustee <user@example.com> -AccessRights SendAs -Confirm:$falseShow the members of one distribution group.
Get-DistributionGroupMember -Identity <group@example.com> -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddressShow the members of one Microsoft 365 group.
Get-UnifiedGroupLinks -Identity <group@example.com> -LinkType Members -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddressList mailboxes that can still be recovered.
Get-Mailbox -InactiveMailboxOnly -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddress
Get-Mailbox -SoftDeletedMailbox -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddressList transport rules, their state and priority.
Get-TransportRule | Select-Object Name,State,Priority,ModeList the email domains the tenant accepts.
Get-AcceptedDomain | Select-Object DomainName,DomainType,DefaultSee which mailboxes allow POP, IMAP and ActiveSync.
Get-EXOCASMailbox -ResultSize Unlimited -Properties PopEnabled,ImapEnabled,ActiveSyncEnabled | Select-Object PrimarySmtpAddress,PopEnabled,ImapEnabled,ActiveSyncEnabledSee the computer name, Windows edition and build.
Get-ComputerInfo | Select-Object CsName,OsName,OsVersion,OsBuildNumberSee profiles and last use before moving data or replacing a PC.
Get-CimInstance Win32_UserProfile | Where-Object { -not $_.Special } | Select-Object LocalPath,Loaded,LastUseTimeSee size and free space on local drives.
Get-CimInstance Win32_Volume -Filter 'DriveType=3' | Select-Object Name,Label,@{n='SizeGB';e={[int]($_.Capacity/1GB)}},@{n='FreeGB';e={[int]($_.FreeSpace/1GB)}}Show the latest Windows updates, newest first.
Get-CimInstance Win32_QuickFixEngineering | Sort-Object InstalledOn -Descending | Select-Object -First 15 HotFixID,Description,InstalledOnSee page file size and peak use.
Get-CimInstance Win32_PageFileUsage | Select-Object Name,AllocatedBaseSize,CurrentUsage,PeakUsageSee encryption status for each drive.
Get-BitLockerVolume -ErrorAction SilentlyContinue | Select-Object MountPoint,VolumeStatus,ProtectionStatus,EncryptionPercentageSee the status of connected devices, such as keyboards.
Get-PnpDevice -Class Keyboard -PresentOnly | Select-Object Status,FriendlyName,InstanceIdCheck whether a printer is installed and its port.
Get-CimInstance Win32_Printer | Select-Object Name,PortName,Default,PrinterStatusView the current power plan settings.
powercfg /q SCHEME_CURRENT SUB_SLEEP STANDBYIDLE
powercfg /q SCHEME_CURRENT SUB_BUTTONS LIDACTIONSee SQL services and their state.
Get-CimInstance Win32_Service | Where-Object { $_.Name -match '^(MSSQL|SQLAgent|SQLSERVERAGENT|SQLBrowser|ReportServer)' } | Select-Object Name,State,StartMode,StartNameLook for crash, shutdown and restart events in the last 7 days.
Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6008; StartTime=(Get-Date).AddDays(-7)} | Format-Table TimeCreated,Id,Message -WrapList errors from the Application log in the last 6 hours.
Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2; StartTime=(Get-Date).AddHours(-6)} -ErrorAction SilentlyContinue | Format-Table TimeCreated,ProviderName,Id -AutoSizeRead recent events from the virtual switch log.
Get-WinEvent -LogName 'Microsoft-Windows-Hyper-V-VmSwitch-Operational' -MaxEvents 40 -ErrorAction SilentlyContinue | Format-Table TimeCreated,Id,Message -WrapSee whether a VM is running.
Get-VM <VMName>See the virtual switch, status and IP addresses of a VM.
Get-VMNetworkAdapter -VMName <VMName> | Format-Table SwitchName,Status,IPAddresses -AutoSizeSee each switch, its type and physical adapter.
Get-VMSwitch | Format-Table Name,SwitchType,NetAdapterInterfaceDescription -AutoSizeInstall the VMware management module for your account.
Install-Module VMware.PowerCLI -Scope CurrentUserA value of 0 means LLMNR is turned off by policy. No result means no policy is set.
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient' -Name EnableMulticast -ErrorAction SilentlyContinue | Select-Object EnableMulticastA value of 0 means mDNS is turned off. No result means no setting has been made.
Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name EnableMDNS -ErrorAction SilentlyContinue | Select-Object EnableMDNSA TcpipNetbiosOptions value of 2 means NetBIOS is turned off on that adapter.
Get-CimInstance Win32_NetworkAdapterConfiguration -Filter 'IPEnabled = True' | Select-Object Description,TcpipNetbiosOptionsCopy documents and settings, skipping AppData, and write a log. Check the source and destination before running.
robocopy "C:\Users\<UserName>" "<D:\Backup\UserName>" /E /COPY:DAT /R:1 /W:1 /XJ /XD AppData /LOG:"<D:\Backup\UserName.log>"Let scripts run in this window. The setting ends when the window closes.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -ForceRemove the internet download flag from a script you trust.
Unblock-File -Path <.\Script.ps1>Stop Excel processes with no open window. Save your work first.
Get-Process EXCEL -ErrorAction SilentlyContinue | Where-Object { $_.MainWindowTitle -eq '' } | Stop-Process -ForceUpdate one installed app by its package ID.
winget upgrade <Publisher.AppName>No commands match. Try a different word or category.
Test commands on one system first, use them only on systems you are authorised to manage, and read what a command does before running it. Some commands need an elevated PowerShell window or the matching module. These commands are provided as a guide, without warranty.
PowerShell commands let IT teams check and manage Windows, networks, Active Directory and Microsoft 365 from a command line. They are useful when you need a quick answer or want to repeat the same step on many systems.
Many read-only commands work in a normal window. Commands that change settings often need an elevated window, and some need a module such as ExchangeOnlineManagement or the Active Directory tools.
Text such as <UserName> is a placeholder. Replace it, including the brackets, with your own value before you run the command.
Commands marked read-only only view information. Commands marked as making changes can affect your system, so test them first and use them only on systems you are authorised to manage.
Contact ZSI at support@zenservices.tech or +592-735-5555, or see our managed IT services.