Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Replace values bacsed on on odd or even number

$
0
0

I want to change the computer locations in multiple test files base on whether they are even or odd

What is the best cmdlet and also syntax to run, if you want to replace all the computers whose computername end with an even number and also all the computernames whose computername ends with odd numbers.

i.e If computername = Pec122(Even number) then

$_.Replace (Locaion="Nedy" ','Location="Dale"')

else

$_.Replace (Locaion="Jam" ','Location="Yale"')


Viewing all articles
Browse latest Browse all 6937

Trending Articles