Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MSAdministrator/d40ecf05a30790f9979f9858c21cb993 to your computer and use it in GitHub Desktop.
Save MSAdministrator/d40ecf05a30790f9979f9858c21cb993 to your computer and use it in GitHub Desktop.
comObject.types.ps1xml
<!--
Copy from: Abhishek's PowerShell Blog - http://abhishek225.spaces.live.com/blog/
Original post: http://abhishek225.spaces.live.com/blog/cns!13469C7B7CE6E911!165.entry
-->
<Types>
<Type>
<Name>System.__ComObject</Name>
<Members>
<ScriptMethod>
<Name>GetProperty</Name>
<Script>
$type = $this.gettype();
$type.invokeMember($args[0],[System.Reflection.BindingFlags]::GetProperty,$null,$this,$null)
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>SetProperty</Name>
<Script>
$type = $this.gettype();
$type.invokeMember($args[0],[System.Reflection.BindingFlags]::GetProperty,$null,$this,@($args[1]))
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>InvokeParamProperty</Name>
<Script>
$type = $this.gettype();
$index = $args.count -1 ;
$methodargs=$args[1..$index]
$type.invokeMember($args[0],[System.Reflection.BindingFlags]::GetProperty,$null,$this,$methodargs)
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>InvokeMethod</Name>
<Script>
$type = $this.gettype();
$index = $args.count -1 ;
$methodargs=$args[1..$index]
$type.invokeMember($args[0],[System.Reflection.BindingFlags]::InvokeMethod,$null,$this,$methodargs)
</Script>
</ScriptMethod>
</Members>
</Type>
</Types>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment