The “Hey, Scripting Guys!” blog has been retired. There are many useful posts in this blog, so we keep the blog here for historical reference. However, some information might be very outdated and many of the links might not work anymore.
New PowerShell content is being posted to the PowerShell Community blog where members of the community can create posts by submitting content in the GitHub repository.
Scripting Blog [archived]
Formerly known as the "Hey, Scripting Guy!" blog
Latest posts
PowerTip: Use PowerShell to add exclusion folder to Windows Defender
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.
PowerTip: Flush file system cache by using PowerShell
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.
PowerTip: Use PowerShell to remove app package from image
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
PowerTip: Fully format drive using PowerShell
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
PowerTip: Use PowerShell to format drive
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
Finding WMI classes that contain methods
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...
PowerTip: List all WMI classes
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.
Use CIM cmdlets to find WMI classes
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...
PowerTip: Find default PowerShell modules
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.