if - Powershell 1.0 CmdLet
ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »
if
Description
Conditionally perform a command
Usage
Options
Example(s)
Replace the text in the variable $MyDemoVar:
PS C:\>if ($MyDemoVar -like "*SS64*") {$MyDemoVar -replace "SS64", "Demonstration Example"}
Print the running services in green and stopped services in red:
PS C:\>get-service | foreach-object{ if ($_.status -eq "stopped") {write-host -f red $_.name $_.status}` else{ write-host -f green $_.name $_.status}}
