Posts with #PowerShellTips

#PowerShellTips

Public posts on X that use #PowerShellTips.

Related hashtags

  1. Sean Metcalf✓@PyroTek3
    I dabble in PowerShell & decided to share some tips that work for me. Want to provide an object property value in output? You can put it inside this: "$()" Write-Output "The user ($ADUser.ServicePrincipalName) has the SPN: ($ADUser.ServicePrincipalName)" #PowerShellTips
    745165
  2. Sean Metcalf✓@PyroTek3
    @PyroTek3
    Have an array with properties and want to put all those properties into a new array, try this: $ADUserArray | select DistinguishedName -ExpandProperty DistinguishedName ExpandProperty in this instance removes the property "header": DistinguishedName ----------- #PowerShellTips
    219
  3. Sean Metcalf✓@PyroTek3
    @PyroTek3
    I use help functionality in PowerShell cmdlets extensively Get-Help Get-ADUser -Examples Help Get-ADUser -Full I have found Googling the cmdlet name provides extensive information in an Microsoft reference doc. #PowerShellTips
    207
  4. Sean Metcalf✓@PyroTek3
    @PyroTek3
    Finding the right cmdlet to do something can be tough sometimes. get-command can help. Wildcard search for cmdlets with "GPO" in the name Get-Command "*GPO*" We can also look specifically in a PS module for cmdlets Get-Command -module GroupPolicy #PowerShellTips
    109
  5. Sean Metcalf✓@PyroTek3
    @PyroTek3
    If you have a block of code that you know may error out in some circumstances, you can hide it. Test-Connection TRDDC01 -ErrorAction SilentlyContinue Try & CATCH can help & provide helpful info Try { Do-Something } Catch { Write-Warning "An error occurred" } #PowerShellTips
    1012
  6. Show more posts