Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSVersion check and bail #169 #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add OSVersion check and bail #169 #170

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 27, 2017

Add OSVersion Check and Bail.

Add OSVersion Check and Bail.
@@ -51,6 +51,11 @@ function GetTimestampUTC {
Get-Date (Get-Date).ToUniversalTime() -Format "yyyy-MM-ddTHH:mm:ssZ"
}

if($((Get-WmiObject Win32_OperatingSystem).Name).Contains(" XP ")){
Write-Error ("{0}: This script is not supported on Windows XP." -f (GetTimestampUTC))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not work as expected for all localized versions of Windows. Also, XP and 2K3 are the same major.minor version number, but this check only looks for XP. Better to go by the major.minor version number returned by (Get-CimInstance Win32_OperatingSystem).Version and make sure that value is greater than 5.2. From memory, I can't recall if Get-CimInstance works on all windows OS versions, need to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant