Getting myself into a terrible pickle;
I have two functions, 1 which works seemingly as expected, the other less so;
Here is the first which checks whether an OS HFB is installed and if so correctly exits stating so but will drop to the catch if it is not installed.
The second which checks for XA HFB does not. It will always result in " .. not installed."
Would appreciate any pointers with this.
Cheers, Paul.
I have two functions, 1 which works seemingly as expected, the other less so;
Here is the first which checks whether an OS HFB is installed and if so correctly exits stating so but will drop to the catch if it is not installed.
Code:
Function CheckHFB()
{
Param ($HFBName)
Try
{ if (!(Get-Hotfix -id $HFBName -ComputerName $server -ErrorAction Stop) ) { "$HFBName is not installed..." }
else {
((Get-Hotfix -id $HFBName -ComputerName $server -ErrorAction Stop) )
"$HFBName is installed" }
return $ServiceResult
} Catch { "Error while checking the HFB. Server may be down or has a permission issue." }
}
The second which checks for XA HFB does not. It will always result in " .. not installed."
Code:
Function CheckXAHFB()
{
Param ($XAHFBName)
Try
{ if (!(Get-XAServerHotFix $server | where-object {$_.hotfixname -like '$XAHFBName'} ) ) { "$XAHFBName is not installed..." }
else {
((Get-XAServerHotFix $server | where-object {$_.hotfixname -like '$XAHFBName'} ) )
"$XAHFBName is installed" }
return $ServiceResult
} Catch { "Error while checking the XAHFB $XAHFBname. Server may be down or has a permission issue."}
}
Would appreciate any pointers with this.
Cheers, Paul.
Last edited: