Intune Initial Scripts Backup
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
$WSUSGroup = Read-Host "Enter Target Group Name"
|
||||
$Computers = Get-WsusComputer -ComputerTargetGroups "$WSUSGroup" -IncludeSubgroups|select Fulldomainname -ExpandProperty Fulldomainname
|
||||
|
||||
foreach ($computer in $computers){
|
||||
if(!(Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet))
|
||||
{write-host "cannot reach $computer" -f red}
|
||||
|
||||
else {$Session = New-Object -ComObject "Microsoft.Update.Session"
|
||||
|
||||
$Searcher = $Session.CreateUpdateSearcher()
|
||||
|
||||
$historyCount = $Searcher.GetTotalHistoryCount()
|
||||
|
||||
$Searcher.QueryHistory(0, $historyCount) | Select-Object @{Name="Computer"; Expression={$Computer}}, Date,
|
||||
|
||||
@{name="Operation"; expression={switch($_.operation){
|
||||
|
||||
1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}}}},
|
||||
|
||||
@{name="Status"; expression={switch($_.resultcode){
|
||||
|
||||
1 {"In Progress"}; 2 {"Succeeded"}; 3 {"Succeeded With Errors"};
|
||||
|
||||
4 {"Failed"}; 5 {"Aborted"}
|
||||
|
||||
}}},Title| Where {$_.Status -eq "In Progress"}|Write-Host}}
|
||||
Reference in New Issue
Block a user