samples/example1.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#requires -RunAsAdministrator [CmdletBinding()] param() if (not(Get-Module cmHealthCheck -ListAvailable)) { try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Set-PSRepository -Name PSGallery -InstallationPolicy Trusted } catch { Write-Output "error: $($_.Exception.Message -join ';')" } } $params = @{ SmsProvider = "cm01.contoso.local" CustomerName = "Contoso" Author = "Your Name" CopyrightName = "Contoso Corporation" NoHotFix = $True Detailed = $True Overwrite = $True } Invoke-CMHealthCheck @params |