A S
asked on
Batch file or powershell to check the version of installed program and OS
hello Experts,
I am in process of creating a Script that check for operating system version and software installed version. if the operating system build number equals 16299 and installed software version 2.8 dont do nothing if not throw a message, to update for software.
Is that possible
i got these but, dont know where to go.
Thanks
I am in process of creating a Script that check for operating system version and software installed version. if the operating system build number equals 16299 and installed software version 2.8 dont do nothing if not throw a message, to update for software.
Is that possible
Get-WmiObject -Class Win32_Product | Select-Object Name, Version | Where-Object -FilterScript {$_.Name -like "*"}
[environment]::OSVersion.Version
i got these but, dont know where to go.
Thanks
Your where-object is not needed. You are asking to filter against a wind card. What you are doing is saying where anything = anything.
The OS part is easy
if( [environment]::OSVersion.Version.Build -eq 16299 )
{
# check the app version
}
What is the name of the app?
ASKER
Thanks Micheal,
I came up with below
I came up with below
$WindowsVersion = [environment]::OSVersion.Version.Build
if( $WindowsVersion -match "16299" ) {
Write-Output "success"
}
else
{
Write-Output "fail"
}
if (Get-WmiObject -Class Win32_Product | Where-Object -FilterScript {$_.Name -eq "McAfee Agent"} | Where-Object -FilterScript {$_.version -eq "10.01"} | Format-List -Property Name,Version) {
Write-Output "success"
}
else
{
Write-Output "fail"
}
Is there any option in powershell like GOTO. if version matches check for product both success dont do nothing, if any of that fails shutdown computer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.