Learn about Windows PowerShell
Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1.
Honorary Scripting Guy, Sean Kearney, is here this week to have a little interesting fun. We’re going to dive undercover and take a look at some of the additional modules that are built-in to Windows 8.1 that you may not be aware of. Or possibly you were, but you’re like me—you looked at that big pile of modules and had one word to say: “Whoa!”
Or if you were Ed, it would be, “Whoa! Dude!”
But today I had some time to play about, and I decided to see what each module could do—or what it might do.
Last week we played with some of the Network modules. I envy my former coworkers at McKesson Canada who probably get to use these every day now! To review the series, start with Windows Server 2012 R2 Network Cmdlets: Part 1.
Today I opened the hood and found a few modules that I was curious about. There are some that you might not have realized there are now cmdlets for. For example, I did not know I could easily adjust the settings in the built-in Windows Search with Windows PowerShell. The module is called WindowsSearch, and it has two simple cmdlets:
Running the Get-WindowsSearchSetting will show me how my Windows Search is presently configured.
So if you needed to quickly tweak a computer to not get web results in the search, you can do this in Windows PowerShell:
Set-WindowsSearchSetting –EnableWebResultsSetting $FALSE
Or if you’d like to ensure that there are web results, but the Safe Search settings are cranked up for kids or employees who tend to play Angry Birds too much:
Set-WindowsSearchSetting –EnableWebResultsSetting $TRUE –SafeSearchSetting Strict
These settings are per user, so they don’t require elevation to run them. So it’s a pretty simple module, but it meets the task nicely.
Digging down further…
I didn’t realize we have a module for Windows Defender! There are actually quite a few cmdlets supplied with this one:
Right off the bat, here are some pretty cool ones that you could leverage on a home computer. Let’s imagine you have Windows Defender configured just the way you like it on a computer. If only there was an easy way to carry those settings and put them on a new machine. Hmmmm…
With Windows 8.1, we can execute the Get-MPPreference cmdlet to see those settings:
Get-MPPreference | Export-CLIXML C:\DefenderSettings.XML
On a new Windows 8.1 workstation at a client’s home, you could preconfigure Windows Defender by using your DefenderSettings.xml file to get your original settings:
$Settings = Import-CLIXML C:\DefenderSettings.XML
Set-MPPreference –UILockdown $Settings.UILockdown
Set-MPPreference –ExclusionPath $Settings.ExclusionPath
Did you know you can list all of the viruses and malware that Windows Defender is aware of?
Get-MPThreatCatalog | Format-Table
You could export that list to a CSV file like this:
Get-MPThreatCatalog | Export-CSV C:\BadGuys.csv
You could even force an immediate update of antivirus and force a scan on the workstation from Windows PowerShell with this module:
If I was managing small business machines, I can immediately see where this free module would be handy! I could have a script to do all the work, and then run this cmdlet at the end to give me a report:
Pop back in tomorrow. We’ll spend a little more time under the hood to see what other modules Windows PowerShell and Windows 8.1 have hidden for us!
I invite you to follow The Scripting Guys on Twitter and Facebook. If you have any questions, send an email to The Scripting Guys at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then remember eat your cmdlets each and every day with a taste dash of creativity.
Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy