0
我的任務是創建一個報告,我需要找到只有Office 365 ProPlus而不是OneDrive的機器。我們有一個混合的環境,出於商業目的,一些機器都有,而其他機器只有O365。我需要所有具有O365的機器清單(清除O365 \ OneDrive組合機器)。僅當其他軟件不存在時才使用特定軟件查找機器
這是我目前:
$OutPath = "c:\Machines_with_O365.csv"
$Software = "Microsoft Office 365 ProPlus*"
$Computers = Get-ADComputer -Filter *
foreach ($Computer in $Computers) {
$Ping = Test-Connection -ComputerName $Computer.Name -Quiet -Count 1
if ($Ping -eq $true) {
try {
$MachineName = $Computer.Name
Get-WmiObject -Class Win32_Product -ComputerName $computer.Name -ErrorAction Stop |
? {$_.Name -like $Software} |
Select-Object @{N="ComputerName";E={$Computer.Name}}, Vendor, Name |
Export-Csv $OutPath -Append
} catch {
Write-Host "Unable to Obtain WMI Object of $MachineName"
}
}
}
if ($Ping -eq $false) {
Write-Host "The $MachineName is not pingable"
}
我需要什麼添加\變化讓我到終點?