10 amazing things you can do with Windows PowerShell
It’s no secret that Windows PowerShell can make all sorts of administrative tasks easier and more convenient, but you may not know just how much it can do. This Windows PowerShell tutorial will show you ten amazing things you can do with the popular tool—including shortcuts, neat options, and useful commands—that will help you be more productive in your day-to-day computer usage. Whether you’re an advanced user or just getting started with the popular scripting language, these tips are sure to improve your PC experience by leaps and bounds!
Run Computer Management Tasks
One of the cool things that Windows PowerShell offers is access to the Computer Management console. The Computer Management console provides access to a number of different management tasks including Device Manager, Event Viewer, Shared Folders, and Services. There are two methods for accessing the Computer Management console from within a script. You can either use cmdlets from the System32 directory, or use shortcuts from any location on your system.
Connect To SharePoint 2010
To learn how to connect to a SharePoint 2010 site, first open up the SharePoint Management Shell and then type Get-SPOSite Connect-SPOServer. For more information on what options are available when creating this connection, type Get-Help Connect-SPOServer. You’ll also need to enter credentials at the prompt that appears by either typing in those credentials or by running Get-Credential and then entering those new credentials when prompted.
Use ADSI Edit
The Active Directory Services Interface (ADSI) is a set of COM interfaces that enable the manipulation of a number of directory and file services. Using ADSI Edit, you can configure settings on objects in Active Directory and view the properties of those objects. This tool is bundled with all supported versions of Microsoft Windows but doesn’t come installed by default. You’ll have to download it if you want to use it!
Create COM Objects in PowerShell
This post will show you how to create some COM objects in PowerShell. We’ll start by checking if our computer has at least PowerShell v3 installed, which is necessary for many of the commands in this post.
Query Active Directory
Finding the users that have been inactive in the last 30 days:
Get-ADUser -Filter {lastLogonTimeStamp -lt (Get-Date).AddDays(-30)} Where-Object {$_.LastLogonTimeStamp -lt (Get-Date).AddDays(-30)}
Install Applications Remotely via Group Policy
You may find that there are times when it’s necessary to install an application remotely on a computer. In this scenario, you may want to configure the software deployment through Group Policy (GPO). You will first need to specify an OU and place the computers you wish to target into the group. You’ll then need to specify the GPO and select the Computer Configuration\Administrative Templates\Windows Components\App Package Deployment section.
Automate disk cleanup tasks using registry files
Open Registry Editor, click HKEY_LOCAL_MACHINE and then click SOFTWARE, then go to the path tree that is software\microsoft\windows NT\currentversion and then look for a subkey below this called SystemFilesCache. You need to create a DWORD in this folder called MaxSize. Double-click on it, change the Value data to zero (0) and give it another name like KeepFileClean.
Install software remotely using Group Policy Preferences.
A really cool feature that I haven’t seen used a lot is using Group Policy Preferences to install software on remote computers. We run into times where we want to install programs and if we’re not in the office it’s not always possible to get on the computer. So how can we do this? Well, one solution is to use Group Policy Preferences. To set this up, open GPEdit and navigate down to Preferences -> Software Installation.
Create logon scripts without writing code in a language like VBScript, JScript, or C#.
With Windows PowerShell scripts, it is possible to create any login script imaginable without writing a single line of code. All that is needed is a bit of know-how and some creativity.
Configure WSUS Server Settings from Powershell (WSUSAdmin tool).
Most people are used to the idea of clicking around in the Group Policy Management console to set up WSUS Server Settings, but it’s much easier to use Powershell. WSUSAdmin is a Powershell module that includes a number of commands that make managing your WSUS server quick and easy.