Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param(
- [string]$computerName="",
- [string]$IgnoreList = @("Dell Digital Delivery Service","Skype Updater", "Software Protection","Manager für heruntergeladene Karten"),
- [string]$UserName = "",
- [string]$Password = ''
- )
- $IgnoreScript = 'Google Update Service (gupdate)'
- $IgnoreCombined = $IgnoreList + $IgnoreScript
- # Generate Credentials Object
- $SecPasswd = ConvertTo-SecureString $Password -AsPlainText -Force
- $Credentials = New-Object System.Management.Automation.PSCredential ($UserName, $secpasswd)
- $Services = Invoke-Command -Credential $Credentials -ComputerName $computerName -ScriptBlock {
- $Services = (Get-Service| Select-Object DisplayName,Status,StartType | Where-Object {$_.StartType -eq "Automatic" -and $_.Status -eq "Stopped" })
- return $Services
- }
- $FilteredServices = @();
- Foreach($Service in $Services){
- if(-Not ($IgnoreCombined.Contains($Service.DisplayName)))
- { $FilteredServices += $Service }
- }
- if($FilteredServices.Count -ne 0)
- { Write-Host ([string]::Format("{0}:There are {0} stopped automatic services: {1}",$FilteredServices.Count,($FilteredServices | Select -Expand DisplayName ) -join ", ")) }
Add Comment
Please, Sign In to add comment