Last active
August 29, 2015 14:22
-
-
Save norbinsh/994d4c00e728ed0a6c42 to your computer and use it in GitHub Desktop.
MSI install if enough processors - env:path *Practice*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Making sure the variables used in the script have their value set to $null before starting | |
$cpu = $null; | |
$cpupath = $null; | |
$msipackage = $null; | |
#Declaring variables | |
$cpupath = (gci env:\NUMBER_OF_PROCESSORS).value; | |
$msipackage = 'c:\users\shay\desktop\package.msi' | |
#Simple function to install the .MSI package if | |
Function Install-Package | |
{ | |
msiexec /i /a $msipackage /qn | |
} | |
if ($cpupath -ge 4) #Making sure there are 4 or more processors | |
{ | |
Install-Package #If true, installing the MSI package silently | |
} | |
else #If less than 4 processors, writing a warnning message and exiting | |
{ | |
Write-Warning "You need to have 4 or more processors in order to install this package"; | |
Exit-PSSession | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment