Browse by Tags

Tagged Content List
  • Blog Post: PowerTip: List All Parameters for a Cmdlet

    Summary : Learn to provide a parameter list for a cmdlet in a viewable table. I am trying to work with cmdlets with so many parameters that I am having a hard time reading them in Get-Help . Is there a way to list them in a single table? Access the Parameters property by using Get-Command and the...
  • Blog Post: PowerTip: Identify All Properties for Active Directory User

    Summary : Use the –Properties parameter to find all properties attached to an Active Directory user. How can I use Windows PowerShell rather than digging through the ADSI editor to find the available properties for a user in our Active Directory? Leverage the –Properties parameter on...
  • Blog Post: PowerTip: Use PowerShell to Determine ASCII Value

    Summary : Learn to use Windows PowerShell to determine the ASCII numeric value of a character. How can I use Windows PowerShell to tell the ASCII value of a character? You can get the numeric value of an ASCII character quite easily, for example, to get the value of the lowercase letter a , type...
  • Blog Post: PowerTip: Convert Plain Text to Secure String

    Summary : Learn to convert a plain text password to a secure string for cmdlet parameters. I'm trying to convert some scripts to work with the Active Directory modules, but they need a secure string for the password. How do I create one of these? Use the ConvertTo-SecureString cmdlet, capture...
  • Blog Post: PowerTip: Find List of Users in Active Directory

    Summary : Use the Filter parameter in the Active Directory module. I was playing with the Active Directory cmdlets and noticed that they seem to need the Distinguished Name. Is there any way to find users instead of supplying this very explicit object each time? Use the –Filter parameter...
  • Blog Post: PowerTip: Remove Spaces from Both Ends of String

    Summary : Learn to use Windows PowerShell to remove spaces from both ends of a string. How can I use Windows PowerShell to remove spaces at both ends of a string? Use the Trim method from the System.String .NET Framework class. In this example, I create a string with a space at each end of the...
  • Blog Post: PowerTip: Use PowerShell Split Operator to Break Strings

    Summary : Learn how to use the Windows PowerShell Split operator to break up strings. How can I use Windows PowerShell to break a string at a specific character? Use the Split operator and specify the character to split on, for example: PS C:\> "this,is,a,string" -split ","
  • Blog Post: PowerTip: Create Empty String with PowerShell

    Summary : Learn how to create an empty string by using Windows PowerShell. How can I use Windows PowerShell to create an empty string? Use the static Empty field from the System.String class: [string]::Empty
  • Blog Post: PowerTip: Use PowerShell to Get Hash Code of Tuple

    Summary : Learn how to get the hash code of a tuple by using Windows PowerShell. How can I use Windows PowerShell to get the hash code for a tuple? Call the GetHashCode method from your Tuple object —for example, this command creates a tuple and obtains the hash code of it: $t = [tuple...
  • Blog Post: PowerTip: Remove First Two Letters of String

    Summary : Learn how to use Windows PowerShell remove the first two letters from a string. How can I use Windows PowerShell to remove the first two letters from a string? Use the SubString method, for example: $a = “String” $a.substring(2)
  • Blog Post: PowerTip: Generate Random Beeps with PowerShell

    Summary : Use Windows PowerShell to generate random beeps. How can I generate random beeps by using Windows PowerShell? Create a range of numbers between 190 and 8500 that will determine the tone. Use the Get-Random cmdlet to choose a random number of tones. Pipe the results to the ForEach-Object...
  • Blog Post: PowerTip: Count a Range of Seconds with PowerShell

    Summary : Use Windows PowerShell to count a range of seconds. How can I use Windows PowerShell to count a range of seconds of increasing duration? Use the range operator to create a range of numbers, then pipe the results to the ForEach-Object cmdlet inside a script block call Start-Sleep : ...
  • Blog Post: PowerTip: Find Information About ErrorActionPreference

    Summary : Find information, beyond the basics, for the Windows PowerShell variable ErrorActionPreference . How can I use Windows PowerShell to see information, beyond only the value, for the variable ErrorActionPreference ? Use the Get-Variable cmdlet and pipe the results to the Format-List cmdlet...
  • 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: PowerTip: Find Information About PowerShell Cmdlet Parameter Sets

    Summary : Learn how to find information about Windows PowerShell cmdlet parameter sets. How can I find information about the various parameter sets for a specific Windows PowerShell cmdlet? Use Get-Command to return cmdlet information, pipe the results to the Select-Object cmdlet, and expand the...
  • Blog Post: PowerTip: Use PowerShell to Find WMI Classes for Creating

    Summary : Learn to find WMI classes that permit creating stuff. How can I use Windows PowerShell to help me find WMI classes that will permit me to create stuff? Use the Get-CimClass cmdlet, and specify the MethodName of create : Get-CimClass -MethodName create
  • Blog Post: PowerTip: Use PowerShell to Find WMI Classes

    Summary : Learn how to use Windows PowerShell to find WMI classes. How can I use Windows PowerShell to find WMI classes related to the BIOS on my computer. Use the Get-CimClass cmdlet and search for the wildcard term *bios*: Get-CimClass *bios*
  • Blog Post: PowerTip: Difference Between XML PowerShell Cmdlets

    Summary : Understand the difference between XML cmdlets in Windows PowerShell. What is the difference between the Windows PowerShell cmdlets, Export-CliXML and ConvertTo-XML ? The Help file for ConvertTo-XML says: "This cmdlet is similar to Export-CliXML, except that Export-CliXML stores...
  • Blog Post: PowerTip: Looking for Folders and Files in PowerShell

    Summary : Learn about looking for folders and files in Windows PowerShell. Why does this command show me folders instead of files? Dir | Where PSIsContainer -eq False In Windows PowerShell, use the automatic variables $True and $False to refer to Boolean values instead of the string True and...
  • Blog Post: PowerTip: Sorting More than One Column

    Summary : Learn to sort by more than one column in Windows PowerShell. Can I use Windows PowerShell to sort by more than one column, and have the primary column be ascending and secondary column be descending? In the Help examples, you'll see that the Property parameter accepts a hash table...
  • Blog Post: PowerTip: Use Custom Delimiter with CSV File

    Summary : Use a custom delimiter with Windows PowerShell when reading a CSV file. Can I use a delimiter other than the comma ( , ) when reading from a CSV file? Import-CSV has a parameter dedicated for this purpose called -Delimiter : Get-Help Import-Csv -ShowWindow You can easily use...
  • Blog Post: PowerTip: PowerShell Summit Europe 2014

    Summary : The Scripting Wife shares information about Windows PowerShell Summit Europe 2014. Do you have any information about the Windows PowerShell Summit Europe 2014? Windows PowerShell Summit 2014 is Sept 29–October 1, 2014 in Amsterdam. Here is a link to more information...
  • Blog Post: PowerTip: Examine the Most Recent PowerShell Error

    Summary : Learn how to examine the most recent error in Windows PowerShell. My Windows PowerShell command failed with an error. How can I look at the error record? Use the $error automatic variable to it displays the last error. You can see more details by piping it to the Format-List cmdlet and...
  • Blog Post: PowerTip: Learn to Start the PowerShell Pipeline

    Summary : Find cmdlets that permit starting the pipeline in Windows PowerShell. How do I find all the Get commands that allow me to start a pipeline? Although there are a number of ways, the Get-Command cmdlet has a parameter called -Verb for this purpose: PS > Get-Command -Verb Get CommandType...
  • Blog Post: PowerTip: Document Server's IP Addresses by Using PowerShell

    Summary : Use Windows PowerShell to document the IP addresses on a server. How can I use Windows PowerShell to easily go through my server environment and document the IP addresses in use on each machine? We can do this with a wee bit o' magic from the new Get-NetIPConfiguration cmdlet in Windows...