Difference between revisions of "Power Shell"

Jump to navigation Jump to search
850 bytes added ,  17:32, 23 August 2010
→‎Try...Catch: Minor update
(→‎Variables: Added Environment)
(→‎Try...Catch: Minor update)
Line 623: Line 623:
}
}
</source>
</source>
The error returned by the CmdLet can be found in <code> $_ </code>, so this can be tested to ensure the error is as expected (just because you though a command might fail, doesn't mean it failed in the way you expected).  For example, <code> $_ </code> will contain the bold bit of the following error.
Get-Log : '''Cannot validate argument on parameter 'StartLineNum'. The 0 argument is less than the minimum allowed range of 1. Supply an argument that is greater than 1 and then try the command again.'''
At C:\Users\simonstrutt\Documents\Scripts\ESX-LogTail.ps1:20 char:57
+    $ESXLog = Get-Log $logKey -VMHost $ESX -StartLineNum <<<<  $LineNo
    + CategoryInfo          : InvalidData: (:) [Get-Log], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.Commands.GetLog


[[Category:PowerShell]]
[[Category:PowerShell]]
[[Category:WMI]]
[[Category:WMI]]
[[Category:MySQL]]
[[Category:MySQL]]

Navigation menu