Browse by Tags

Tagged Content List
  • Blog Post: PowerTip: Keep Up with Hey, Scripting Guy! Blog

    Summary : Easily keep up with Hey, Scripting Guy! Blog posts. How can I easily keep up with Hey, Scripting Guy! Blog posts? Install the Scripting Guys app on your Windows Smart Phone. It is in the store, and it works great.
  • Blog Post: PowerTip: Examine Default PowerShell Parameter Values

    Summary : Examine default Windows PowerShell parameter values. How can I check to see if I have enabled any default Windows PowerShell parameter values? Check the value of the $PSDefaultParameterValues variable.
  • Blog Post: PowerTip: Better Way to View PowerShell Help

    Summary : Learn a better way to view Windows PowerShell Help. I like the Windows PowerShell Help files, but I do not like trying to read them in the Windows PowerShell console window. What is a better way to read the content? Use the –ShowWindow parameter from Get-Help . This example displays...
  • Blog Post: PowerTip: Find PowerShell Profiles

    Summary : Learn how to easily find Windows PowerShell profiles. How can I Question: You want to find the path to Windows PowerShell profiles? Use the $Profile automatic variable, but pipe the output to the Format-List cmdlet and use the –Force parameter. Here is an example that uses the FL...
  • Blog Post: PowerTip: Retrieve Last Token Received by PowerShell

    Summary : Learn how to retrieve the last token that was received by Windows PowerShell. How can I retrieve the last token received by Windows PowerShell? Use the $$ automatic variable: PS C:\> notepad C:\fso\AMoreComplete.txt PS C:\> $$ C:\fso\AMoreComplete.txt
  • Blog Post: PowerTip: Find User's Home Directory in PowerShell

    Summary : Find the path to the current user's home directory in Windows PowerShell. How can I easily find the current user's home directory for a script I am writing? Use the $home automatic variable: PS C:\> $HOME
  • Blog Post: PowerTip: Find Current Directory in PowerShell

    Summary : Easily find the current directory in Windows PowerShell. How can I return a path object that contains information about the current working directory in Windows PowerShell? Use the $pwd automatic variable: PS C:\> $pwd
  • Blog Post: PowerTip: Determine if Property is Member of Object

    Summary : Determine if a property is a member of an object in Windows PowerShell. How can I determine if a specific property is actually a member of an object in my Windows PowerShell script? Use the Get-Member cmdlet, and cast the response into a Boolean data type by using the [bool] type accelerator...
  • Blog Post: PowerTip: Roll Back Active PowerShell Transaction

    Summary : Learn how to roll back an active Windows PowerShell transaction. I started a transaction to modify the registry on my computer running Windows 8.1, but something failed, and I want to roll back the transaction. How can I do this? Use the Undo-Transaction cmdlet to roll back the active...
  • Blog Post: PowerTip: Set Default Location Stack with PowerShell

    Summary : Use Windows PowerShell to set your default location stack. How can I use Windows PowerShell to set the default for some named location stacks that I created? Use the Set-Location cmdlet and specify the stack name, for example: Set-Location -StackName REG
  • Blog Post: PowerTip: Display Locations Stored on Stack

    Summary : Use Windows PowerShell to display locations stored on the default stack. How can I use Windows PowerShell to see the locations that are stored on my default location stack? Use the –Stack parameter of Get-Location : Get-Location -Stack
  • Blog Post: PowerTip: Find PowerShell Cmdlets and Synopsis

    Summary : Use Windows PowerShell to find cmdlets and their associated synopsis. How can I easily find a list of specific Windows PowerShell cmdlets and their associated meanings? Use the Get-Command cmdlet, pipe the results to the Foreach-Object and Get-Help cmdlets, then select the name and synopsis...
  • Blog Post: PowerTip: Find PowerShell Providers

    Summary : Learn how to find Windows PowerShell providers and their capabilities. How can I find what Windows PowerShell providers I have on my system? Use the Get-PSProvider cmdlet. Note Beginning with Windows PowerShell 3.0, some providers load on-demand, and therefore, they do not appear unless...
  • Blog Post: PowerTip: Return Specific Number of Letters from String

    Summary : Use Windows PowerShell to return a specific number of letters from a string. How can I use Windows PowerShell to easily to retrieve the first two letters from a string? Use the SubString method from a string, and then specify the starting the position and the number of letters to return...
  • Blog Post: PowerTip: Save CSV Data and Maintain Unicode Encoding

    Summary : Use Windows PowerShell to save data as a CSV file and maintain the Unicode encoding. How can I use Windows PowerShell to save my data as a CSV file but ensure that it is saved as Unicode? Make sure you specify the –Encoding parameter when you call the Export-CSV cmdlet, for example...
  • Blog Post: PowerTip: Use PowerShell to Remove All CIM Sessions

    Summary : Learn how to use Windows PowerShell to remove all CIM sessions. How can I use Windows PowerShell to delete all the CIM sessions I have created? Use the Get-CIMSession cmdlet to retrieve all CIM sessions, and pipe the results to the Remove-CIMSession cmdlet: Get-CimSession | Remove...
  • Blog Post: PowerTip: Find WMI Parent Class with PowerShell

    Summary : Use Windows PowerShell to easily find a WMI parent class. How can I use Windows PowerShell to find what parent class a particular WMI class derives from? Use the Get-CimClass cmdlet, and select the CimSuperClassName property, for example: (Get-Cimclass win32_bios).CimSuperClassName
  • Blog Post: PowerTip: Remove Type Data with PowerShell

    Summary : Learn how to remove type data by using Windows PowerShell. How can I remove a custom type data that is producing an error message when I try to update it in my Windows PowerShell session? Use the Get-TypeData cmdlet to retrieve an instance of the type data, and pipe it to the Remove-TypeData...
  • Blog Post: PowerTip: Use PowerShell to Find Cmdlets that Use CIM

    Summary : Use Windows PowerShell to find cmdlets that use CIM. I want to see what Windows PowerShell cmdlets will use a CIM session, but when I use Get-Command , only a couple things return. How can I fix this? Windows PowerShell automatically loads modules, but when looking for parameters, it...
  • Blog Post: PowerTip: Use PowerShell to Find File or Folder

    Summary : Learn how to use Windows PowerShell to find a file or a folder. How can I use Windows PowerShell to determine if a variable contains a path that leads to a file or folder? Use the Test-Path cmdlet to test the path stored in the variable, and then specify the PathType parameter, for example...
  • Blog Post: PowerTip: Use PowerShell to Find Files in Wrong Folder

    Summary : Use Windows PowerShell to easily find files that are in the wrong folder. I have a folder for documents and another folder for images. But at times, I discover images in the documents folder. How can I use Windows PowerShell to easily detect this situation? Use the Test-Path cmdlet, and...
  • Blog Post: PowerTip: Find Stats with PowerShell

    Summary : Use Windows PowerShell to find stats of objects. How can I use Windows PowerShell to see the minimum, maximum, and average values of a specific property in a series of objects? Pipe the objects to the Measure-Object cmdlet, specify the property you seek, and use the Average , Maximum...
  • Blog Post: PowerTip: Use PowerShell to Display Shared Folders

    Summary : Use Windows PowerShell to display shared folders. How can I use Windows PowerShell to display shared folders that I set up on a local computer? Use the Get-SMBShare cmdlet and no parameters.
  • Blog Post: PowerTip: Use PowerShell to Verify Syntax of Path

    Summary : Learn how to use Windows PowerShell to verify the syntax of a path. How can I use Windows PowerShell to verify that a path that accepts user input is using the correct syntax? Use the –IsValid parameter of the Test-Path cmdlet, for example: PS C:\> $a = "c:\myfolder\nonexistentfile...
  • Blog Post: PowerTip: Use PowerShell to Find Files Newer than a Date

    Summary : Use the Windows PowerShell to see if a file exists more recent than a certain date. How can I use Windows PowerShell to see if a file more recent than a specific date exists in a folder? Use the Test-Path cmdlet, specify the folder, and use the –NewerThan parameter. The cmdlet expects...