PowerShell Reflection
# type retrieval standard method
[System.Diagnostics.ProcessStartInfo]
# type retrieval reflection method
# referencing a known public class from the same assembly
# the full class name must be specified
[System.Diagnostics.Process].Assembly.GetType('System.Diagnostics .ProcessStartInfo')# standard method
$ProcStartInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo -ArgumentList 'cmd.exe'
# reflection method #1
$ProcStartInfo = [Activator]::CreateInstance([System.Diagnostics.ProcessStartInfo], [Object[]] @('cmd.exe'))
# reflection method #2
$ProcessStartInfoStringConstructor = [System.Diagnostics.ProcessStartInfo].GetConstructor([Type[]] @([String]))
$ProcStartInfo = $ProcessStartInfoStringConstructor.Invoke([Object[]] @('cmd.exe'))Last updated