Difference between revisions of "Power Shell"

Jump to navigation Jump to search
490 bytes added ,  11:26, 3 March 2010
Added "External Processes"
m (→‎Strings: Added "Strip Whitespace")
(Added "External Processes")
Line 144: Line 144:
$wmiobj = Get-WMIObject -query "SELECT * FROM Win32_BIOS" -credential $cred -computer $svr.ip
$wmiobj = Get-WMIObject -query "SELECT * FROM Win32_BIOS" -credential $cred -computer $svr.ip
</source>
</source>
== External Processes ==
One of PowerShell's greatest failings is its inability to run external commands with any predictability, severely limiting tits scope and often forcing you to run small PowerShell scripts from other scripts rather than having one all-in-control PS script. The following example demonstrates how to run any cmd line...
<source lang="powershell">
$cmd = "rrdtool.exe update $rrd $updates"
$proc_res = &$executioncontext.InvokeCommand.NewScriptBlock($cmd)
</source>


== WMI ==
== WMI ==
Cmdlet for using WMI via PowerShell is '''Get-WMIObject''', for example...
Cmdlet for using WMI via PowerShell is '''Get-WMIObject''', for example...


Navigation menu