Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: If statement with -and Never worked

$
0
0

Hi

Just tested this out on my computer and noticed that if I run only:

If ($OS -eq "Microsoft Windows 7 Enterprise")

It would still evaluate to be false.
Checking the output shows that it for some reason adds an extra space after "…Enterprise"

So if you just change this:

If (($OSArch -eq "64-Bit") -and ($OS -eq "Microsoft Windows 7 Enterprise"))

To this:

If (($OSArch -eq "64-Bit") -and ($OS -eq "Microsoft Windows 7 Enterprise "))

–Notice the extra space between Enterprise and "

You would get the result you're after.


Viewing all articles
Browse latest Browse all 13067

Trending Articles