PowerShell is the command line included with Windows. It is a very handy tool for doing simple tasks without the GUI. In this guide, I’ll show you 10 tips that will improve your Windows Server experience and make your life easier.
Getting a Process
Rather than using the Task Manager or a similar tool, you can use PowerShell to retrieve information about a specific process and kill it, if needed. This will show the process ID (
Killing a Process
Once you have the process ID of a process, you can kill it:
Stop-Process -id PID
Getting Contents of a File
You can actually get the content of a file (for example a
.txt file) and view it in PowerShell:
Getting Item Information
You can get information about a certain file with the
Get-Item command. The cool thing about this is that you can use it to return multiple kinds of data, for example, you can see the last time somebody accessed a file:
Adding a New Active Directory User
You can add an Active Directory user with the
New-ADUser -SamAccountName "william" -GivenName "William" -Surname "Edwards" -DisplayName "William David Edwards"
Removing an Active Directory User
Removing an Active Directory user with PowerShell is possible too:
You can use a DN, SAM account name, SID, or an object GUID here.
Adding an Active Directory group
You can add an Active Directory group with PowerShell very easily:
New-ADGroup –name Staff” –groupscope Global
Use the name of the new Active Directory group for
-name and change the group scope if needed.
Removing an Active Directory group
Likewise, you can also remove an Active Directory group with PowerShell:
Finding All Domain Controllers
You can find all domain controllers in a domain with PowerShell by finding out which computers are in the Domain Controllers group:
Get-ADGroupMember 'Domain Controllers'
Disabling an Active Directory account
You can disable an account in Active Directory to prevent a user from logging in. This can be done from PowerShell to avoid having to use the GUI for this simple task:
Again, you can use a DN, SAM account name, SID, or an object GUID here.