Private/ServiceUtil.ps1
# Determines if a Service exists with a name as defined in $ServiceName. # Returns a boolean $True or $False. Function Test-ServiceExists([string] $ServiceName) { [bool] $Return = $False if ( Get-CimInstance -ClassName Win32_Service -Filter "Name='$ServiceName'" ) { $Return = $True } Return $Return } # Deletes a Service with a name as defined in $ServiceName. # Returns a boolean $True or $False. $True if the Service didn't exist or was # successfully deleted after execution. Function Remove-Service([string] $ServiceName) { [bool] $Return = $False $Service = Get-CimInstance -ClassName Win32_Service -Filter "Name='$ServiceName'" if ( $Service ) { Remove-CimInstance -InputObject $Service if ( -Not ( Test-ServiceExists $ServiceName ) ) { $Return = $True } } else { $Return = $True } Return $Return } function Get-PlanningVersion($version) { $vstr = "NA | NA | NA" if ($version -ne $null) { $V = $version.Version $S = $version.StaticDataVersion $D = $version.DynamicDataVersion $vstr = "$V | $S | $D" } return $vstr } function Get-PlanningVersionWeb($version) { $vstr = "NA`t| NA`t| NA" if ($version -ne $null) { $V = $version.Planning $S = $version.Static $D = $version.Dynamic $vstr = "$V`t| $S`t| $D" } return $vstr } |