Browse by Tags

Tagged Content List
  • Blog Post: PowerTip: Round Numbers with PowerShell

    Summary : Easily use Windows PowerShell to round numbers. How can I use Windows PowerShell to easily round numbers? Use the Round static method from the System.Math class, for example: PS C:\> 22/7 3.14285714285714 PS C:\> [math]::Round(22/7) 3 PS C:\>
  • Blog Post: PowerTip: Explore PowerShell Help

    Summary : Use Out-GridView to easily explore Windows PowerShell Help. How can I easily explore Windows PowerShell cmdlets and then see the cmdlet Help from them? Use the Get-Command cmdlet, pipe the output to Out-GridView with the -Wait parameter, and then pipe the results to Get-Help with the...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #7

    Summary : Remember the name of the first holiday tune on the Hey, Scripting Guy! Blog? What was the very first holiday tune done on the Hey, Scripting Guy! Blog? You'll find the answer at the bottom of this post... And here is the answer for the PowerTrivia #6 question: What is the title...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #6

    Summary : Simmer your minds with thoughts of past Scripting Guys holiday specials. What is the title of the fourth Scripting Guys holiday special, which seemed to last an incredibly long night? Think you know the answer? Verify by looking at this surprise post ...or stay tuned. The answer will...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #5

    Summary : Remember this silly song from the second Scripting Guys holiday special? What was the name of the song written for the second Scripting Guys holiday special that suspiciously sounded like gerbils singing? Think you know the answer? Verify by listening to this little parody ...or stay...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #4

    Summary : Remember those wonderful people from the third Scripting Guys holiday special? Who were the two main characters in the third Scripting Guys holiday special, It’s a Wonderful Shell ? Think you know the answer? Verify by reading It’s a Wonderful Shell—Chapter 1 ...or stay...
  • Blog Post: PowerTip: Convert String into DateTime Object

    Summary : Use Windows PowerShell to convert a string into a DateTime object. How can I use Windows PowerShell to easily create a System.DateTime object from a string? Use the [DateTime] type accelerator to convert the string, for example: [datetime]"1/2/14"
  • Blog Post: PowerTip: Create Custom PowerShell Objects

    Summary : Learn about the easiest way to create a custom Windows PowerShell object. How can I easily create a custom object that contains only a few of the existing properties of a Windows PowerShell cmdlet? Use the Select-Object cmdlet in the pipeline and choose the properties you want to add...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #3

    Summary : Remember the characters from previous Hey, Scripting Guys! holiday specials? Who were the characters who handled the IT infrastructure in the second Scripting Guys holiday special, How Mr. Finch Learned Scripting ? Think you know the answer? Verify by reading Use PowerShell to Find and...
  • Blog Post: PowerTip: Expand Objects in PowerShell

    Summary : Learn how to easily expand objects in Windows PowerShell. How can I expand an object that was returned by my Windows PowerShell expression? Use the –ExpandProperty parameter from Select-Object to expand objects in Windows PowerShell. This example expands the System.Diagnostics.ProcessStartInfo...
  • Blog Post: PowerTip: Programmatically Open Script in PowerShell ISE

    Summary : Use Windows PowerShell to open a script in the Windows PowerShell ISE. How can I use Windows PowerShell to run a script that will open another script in a new tab in the Windows PowerShell ISE? Use the CurrentPowerShellTab Files Add method from the $psISE object, for example: $psISE...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #2

    Summary : Remember a holiday tune that entertained us? From the third Scripting Guys! holiday special, can you name the theme song that was sung most horribly off-key by a certain unnamed Windows PowerShell MVP? Think you know the answer? Verify by watching this surprise video ...or stay tuned...
  • Blog Post: PowerTrivia: Scripting Guys Holiday Special Trivia #1

    Summary : Have some fun remembering holiday specials from the past five years. In the very first Scripting Guys holiday special, A PowerShell Carol , who was the poor unhappy fellow who lost his way and would only use VBScript? Think you know the answer? Verify by reading Holiday PowerShell Carol...
  • Blog Post: PowerTip: Require Specific Module in PowerShell Script

    Summary : Learn how to require a specific module in a Windows PowerShell script. How can I prevent a Windows PowerShell script from running if it requires the Active Directory module and the module is not available? At first line of the script, use the #Requires statement to require the Active...
  • Blog Post: PowerTip: Find PowerShell Cmdlets Supplied by Module

    Summary : Find Windows PowerShell cmdlets that are supplied by a specific module. How can I easily see all the cmdlets that ship with the Hyper-V module.? Use the Get-Command cmdlet, and specify the Hyper-V module. (Tab expansion works for module names, which is great because who can remember if...
  • Blog Post: PowerTip: Cause Out-GridView Cmdlet to Pause

    Summary : Use Windows PowerShell to pause the script while the Out-GridView displays. How can I pause the execution of my Windows PowerShell script while the Out-GridView cmdlet displays a grid view? (I do not need to pass information from the grid to the script.) The –Wait parameter from...
  • Blog Post: PowerTip: Use PowerShell Out-GridView to Explore Cmdlets

    Summary : Use the Windows PowerShell Out-GridView cmdlet to aid in exploring cmdlets. How can I use Windows PowerShell to graphically explore cmdlets provided by the Hyper-V module and filter by verb? Use the Get-Command cmdlet and specify the Hyper-V module. Select the name, verb, noun, and definition...
  • Blog Post: PowerTip: Replace Multiple Words in String with PowerShell

    Summary : Use Windows PowerShell to replace multiple words in a string. How can I use Windows PowerShell to replace misspelled words in a string? Use the –Replace operator, for example: $s = "The calander says there are five calendar days left in the callander" $s -replace...
  • Blog Post: PowerTip: Use CIM and PowerShell to Find WMI Classes

    Summary : Use CIM and Windows PowerShell to find WMI classes related to threads. How can I use Windows PowerShell to easily find WMI classes that are related to threads? Use the Get-CimClass cmdlet, and specify a wildcard character for threads: Get-CimClass *thread*
  • Blog Post: PowerTip: Use PowerShell to Determine Weeks Between Dates

    Summary : Use Windows PowerShell to determine the number of weeks between two dates. I have a project that is broken into several major components of work. I know the start date of the project and the end date of the project. How can I use Windows PowerShell to determine the number of weeks between...
  • Blog Post: PowerTip: Zoom the PowerShell ISE

    Summary : Use a Windows PowerShell command to increase zoom in the Windows PowerShell ISE. How can I increase the zoom level in a script that I use to set up the Windows PowerShell ISE before presentations? Use the $host object and the PrivateData object, and set the zoom size to greater than 100...
  • Blog Post: PowerTip: Use PowerShell to See if String Has Wildcard Character

    Summary : Use Windows PowerShell to determine if a string contains a wildcard character. How can I use Windows PowerShell to determine if a string contains a wildcard character? Use the static ContainsWildcardCharacters method from the System.Management.Automation.WildcardPattern .NET Framework...
  • Blog Post: PowerTip: Use PowerShell to Replace Characters in String

    Summary : Use Windows PowerShell to replace non-alphabetic and non-number characters in a string. How can I use Windows PowerShell to replace every non-alphabetic and non-number character in a string with a hyphen? Use the Windows PowerShell –Replace operator and the \w regular expression...
  • 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: 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 ---- ---...