Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

Feb 14, 2016
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to add exclusion folder to Windows Defender

Doctor Scripto

Summary: Use Windows PowerShell to add an exclusion folder to Windows Defender.  How can I add the C:\temp folder to the exclusion list so it is not scanned by Windows Defender?  Use the Add-MpPreference cmdlet and specify the exclusion path, for example: Add-MpPreference -ExclusionPath "C:\Temp" Note  You must run Windows PowerShell with elevated permissions when you execute this command or an error arises.

Feb 14, 2016
Post comments count 0
Post likes count 0

PowerTip: Flush file system cache by using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to forcibly write the file system cache to a drive.  How can I use Windows PowerShell to forcibly flush the volume cache by writing it to a drive?  Use the Write-VolumeCache cmdlet and specify the drive letter, for example: Write-VolumeCache c Note  There is no colon following the drive letter.

Feb 13, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to remove app package from image

Doctor Scripto

Summary: Use Windows PowerShell to remove an app package from a Windows image.  How can I use Windows PowerShell to remove an app package from a Windows image?  Use the Remove-AppxProvisionedPackage cmdlet, for example: Remove-AppxProvisionedPackage –Path c:\offline –PackageName MyAppxPkg

Feb 13, 2016
Post comments count 0
Post likes count 0

PowerTip: Fully format drive using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to do a full format of a drive.  How can I use Windows PowerShell to do a full format of a drive?  Use the Format-Volume cmdlet and specify the -FullFormat parameter, for example: Format-Volume -DriveLetter C -FileSystem FAT32 -FullFormat –Force

Feb 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to format drive

Doctor Scripto

Summary: Learn how to use Windows PowerShell to quickly format a drive.  How can I use Windows PowerShell to quickly format a drive?  Use the Format-Volume cmdlet and specify the drive letter, for example: Format-Volume -DriveLetter D

Feb 12, 2016
Post comments count 0
Post likes count 0

Finding WMI classes that contain methods

Doctor Scripto

Summary: Learn how to find methods from WMI classes. Sometimes when working with WMI, it might seem as if you are entering a strange territory with dangers lurking around every corner. Unfortunately, there might not even be a sign such as the following to alert you to the hidden dangers: But by using the CIM cmdlets, we can bring a bit of order to an otherwise messy situation. If I do not know the name of a WMI method, I can use a wildcard character to find the method. If I use the *, my command will return all WMI classes that have a method defined: Get-CimClass -MethodName * The command and output from the...

Feb 11, 2016
Post comments count 1
Post likes count 0

PowerTip: List all WMI classes

Doctor Scripto

Summary: Use the Get-CimClass cmdlet to easily list all classes in current WMI namespace.  How can I use Windows PowerShell to list all of the WMI classes in the current WMI namespace?  Use the Get-CimClass cmdlet.

Feb 11, 2016
Post comments count 0
Post likes count 0

Use CIM cmdlets to find WMI classes

Doctor Scripto

Summary: Learn how to locate the right WMI class by using the Get-CimClass cmdlet to work through the class schema. Windows Management Instrumentation (WMI) came into the Windows world around the time of the Windows NT 4.0 Service Pack 4—that’s about the same time as the release of Star Wars 1: The Phantom Menace. One of the really cool things about WMI was that I could (with some difficulty) write VBScript scripts that accessed the WMI schema. Therefore, I could use script to search through the WMI classes to help me locate and find information that I would later use in other VBScript scripts. In this way, it wa...

Feb 10, 2016
Post comments count 0
Post likes count 0

PowerTip: Find default PowerShell modules

Doctor Scripto

Summary: Find Windows PowerShell modules that load by default.  How can I easily find what modules are loading in my Windows PowerShell console by default?  Open your Windows PowerShell console, and before doing anything, type Get-Module.