Browse by Tags

Tagged Content List
  • Blog Post: Use the PowerShell Debugger

    Summary : Boe Prox shows how to debug scripts in Windows PowerShell. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the final part in a series of five posts about troubleshooting Windows PowerShell scripts and functions...
  • Blog Post: PowerTip: Create Self-Updating Variable

    Summary : Learn how to create a self-updating variable. How can I create a variable that will automatically update when I call it? Use Set-PSBreakPoint to set a variable that will always have the current date and time (or only time): Set-PSBreakpoint -Variable Time -Mode Read -Action {$Global...
  • Blog Post: Trace Your Commands by Using Trace-Command

    Summary : Boe Prox uses Trace-Command to understand commands. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the fourth part in a series of five posts about troubleshooting PowerShell scripts/functions. The series includes...
  • Blog Post: PowerTip: Use PowerShell to View Trace Sources

    Summary : Use Windows PowerShell to view all trace sources. How can I use Windows PowerShell to see all available trace sources? Use Get-TraceSource cmdlet: Get-TraceSource | Select Name, Description PS C:\> get-tracesource | Select Name, Description Name Description ---- ---...
  • Blog Post: Enforce Better Script Practices by Using Set-StrictMode

    Summary : Boe Prox shows how to use Set-StrictMode to write better scripts. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the third part in a series of five posts about troubleshooting Windows PowerShell scripts and...
  • Blog Post: PowerTip: Use PowerShell to Hide Parameter From IntelliSense

    Summary : Learn how to use Windows PowerShell to hide a parameter from IntelliSense. How can I use Windows PowerShell to hide a parameter from IntelliSense? Introduced in Windows PowerShell 4.0, you can specify the DontShow attribute for the [parameter()] type to hide that parameter from IntelliSense...
  • Blog Post: Troubleshoot by Using Set-PSDebug

    Summary : Boe Prox uses the Set-PSDebug cmdlet to assist in troubleshooting. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the second part in a series of five posts about troubleshooting Windows PowerShell scripts...
  • Blog Post: PowerTip: Use PowerShell to Remove an Item from an Array

    Summary : Use Windows PowerShell remove an item from an array. How can I remove an item from an array? Use the ArrayList class, which has the Remove() method (instead of using System.Array , which does not have this method): PS > $ArrayList = New-Object System.Collections.ArrayList PS...
  • Blog Post: Provide Support by Using Verbose and Debug Streams

    Summary : Provide code support by using Verbose and Debug streams. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the first part in a series of five posts about troubleshooting Windows PowerShell scripts and functions...
  • Blog Post: PowerTip: Avoid Prompt When Using –Debug

    Summary : Boe Prox shows how to avoid being prompted when using –Debug . I love using –Debug in functions to figure out what is going on, but how can I avoid being prompted each time I run into Write-Debug in my code? After you declare your parameters, check for –Debug , and set...
  • Blog Post: What It Means to Be a PowerShell MVP

    Summary : Four Windows PowerShell MVPs share what the title means to them. Microsoft Scripting Guy, Ed Wilson, is here. The MVP Summit is over. Many MVPs began their long trek home last night. Others decided to remain overnight or even over the weekend before heading home. From the feedback I have...
  • Blog Post: PowerTip: View All Values of an Enum

    Summary : Boe Prox shows how to view all values of an enum. How can I view all of the available values of an enum? Use the [ Enum]::GetNames() method, for example: PS C:\ > [Enum]::GetNames([System.ConsoleColor]) Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow...
  • Blog Post: Getting to Know ForEach and ForEach-Object

    Summary : Learn the differences between ForEach and ForEach-Object in Windows PowerShell. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox , here today filling in for my good friend, The Scripting Guy. Today I am going to talk about some differences between using ForEach and using ForEach...
  • Blog Post: PowerTip: Use PowerShell to Locate the Help File You Need

    Summary : Learn how to use Windows PowerShell to find the Help file you need. How can I figure out the exact name of the Help file that I am looking for about sessions? Use a wildcard character with Get-Help to narrow down the scope of the Help files: Get-Help about_*session* Name Category...
  • Blog Post: Weekend Scripter: Build a Clock Widget by Using PowerShell and WPF

    Summary : Boe Prox shows how to use Windows PowerShell to build a clock widget. Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here's a bit about me: Boe Prox is a Microsoft MVP in Windows PowerShell and a senior Windows system administrator....
  • Blog Post: PowerTip: Use PowerShell to Display Known Colors

    Summary : Boe Prox shows how to find all known colors on your computer. How can I use Windows PowerShell to find known colors on my computer and their hex representations? Use the Add-Type cmdlet as follows: Add-Type –assemblyName PresentationFramework [windows.media.colors] | Get-Member...
  • Blog Post: Build a Tool that Uses Constrained PowerShell Endpoint

    Summary : Boe Prox shows how to create a tool that can leverage a remote constrained endpoint to perform a task. Hey, Scripting Guy! How can I create a tool that my Help Desk admins can use to audit and restart services, while limiting their access to the server? —TJ Hello SH, Honorary...
  • Blog Post: PowerTip: Use PowerShell to Display Pop-Up Window

    Summary : Learn how to display a pop-up window by using Windows PowerShell. How can I use Windows PowerShell to display a pop-up window to a user when a script or function has completed? There are several ways to display a pop-up window, but the following command doesn’t require loading assemblies...
  • Blog Post: Use Delegated Administration and Proxy Functions

    Summary : Boe Prox shows how to create a secure PSSession endpoint by using delegated administration and a proxy function. Hey, Scripting Guy! There are some great things that I can do with a constrained Windows PowerShell endpoint. But I want to allow a user (who may not have the necessary rights...
  • Blog Post: PowerTip: Restore Default PSSession Endpoints

    Summary : Learn how to restore default PSSession endpoints. How do I restore my default PSSession endpoints if I accidently unregistered them? Use Enable-PSRemoting to automatically rebuild the remote endpoints on your system: Get-PSSessionConfiguration Enable-PSRemoting –Force #Now...
  • Blog Post: Build Constrained PowerShell Endpoint Using Configuration File

    Summary : Boe Prox teaches you how to build a constrained endpoint by using a configuration file. Hey, Scripting Guy!, is there a better way to lock down my remote endpoint by using something other than a startup script? —SH Hello SH, Honorary Scripting Guy, Boe Prox, here today filling...
  • Blog Post: PowerTip: Test a PSSession Configuration File

    Summary : Learn how to test a PSSession configuration file. How do I ensure that my PSSession configuration is valid? Use the Test-PSSessionConfigurationFile cmdlet to see if the file is valid (True) or not (False). Test-PSSessionConfigurationFile –Path ConstrainedSession.pssc True
  • Blog Post: Build Constrained PowerShell Endpoint Using Startup Script

    Summary : Learn how to build a constrained endpoint by using a startup script. Hey, Scripting Guy!, how do I lock-down my remote endpoint to only certain commands? —GH Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the second part...
  • Blog Post: PowerTip: List Remote PowerShell Endpoint Configurations

    Summary : Learn how to list remote Windows PowerShell endpoint configurations. How can I list remote Windows PowerShell endpoint configurations? Connect-WSMan -ComputerName dc1 sl WSMan: Get-ChildItem dc1\Plugin\microsoft* And here is the output: WSManConfig: Microsoft.WSMan.Management...
  • Blog Post: Introduction to PowerShell Endpoints

    Summary : Learn about Windows PowerShell endpoints and how they relate to remoting. Hey, Scripting Guy! I keep hearing about Windows PowerShell endpoints and constrained endpoints related to remote management. Can you tell me more about these? —KP Hello, KP. Honorary Scripting Guy, Boe...