Adrián Bíro

Miscelaneus Tips

Reflection in Poweshell Get-Member

ConvertFrom-Json -InputObject (Invoke-WebRequest -Uri "www.postman-echo.com/get").Content | Get-Member             
                                                                                                                        
   TypeName: System.Management.Automation.PSCustomObject

Name        MemberType   Definition
----        ----------   ----------
Equals      Method       bool Equals(System.Object obj)
GetHashCode Method       int GetHashCode()
GetType     Method       type GetType()
ToString    Method       string ToString()
args        NoteProperty System.Management.Automation.PSCustomObject args=
headers     NoteProperty System.Management.Automation.PSCustomObject headers=@{x-forwarded-proto=http; x-forwarded-port=80; host=ww
url         NoteProperty string url=http://www.postman-echo.com/get

Similar to the python inspect module.

Unblock module

Get-ChildItem -Path '.' -Recurse -Include '*.ps1','*.psm1','*.psd1' | Unblock-File -Verbose

Enable Debug or Verbose output

PS /home/adrian> function foo {
 [CmdletBinding()]
  Param([parameter(ValueFromRemainingArguments=$true)][String[]] $args)       
 Write-Verbose 'VVVVVVV'
  Write-Debug 'DDDDDDD'  
  Write-Host "host"    
}
PS /home/adrian> foo -Debug -Verbose
VERBOSE: VVVVVVV
DEBUG: DDDDDDD
host
PS /home/adrian>