Skip to content

Instantly share code, notes, and snippets.

@shaneis

shaneis/IfMatch.ps1

Created Oct 20, 2017
Embed
What would you like to do?
Using if and match to check a string
$fileNames | ForEach-Object -Process {
if ($_ -match 'Index') {
"Use index on: $_"
} elseif ($_ -match 'Stats') {
"Use stats on: $_"
} elseif ($_ -match 'Backups') {
"Use backup on: $_"
} elseif ($_ -match 'Restores') {
"Use restores on: $_"
} elseif ($_ -match 'Checkdbs') {
"Use checkdbs on: $_"
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.