Untitled
unknown
plain_text
2 years ago
737 B
6
Indexable
# Path to the CSV file containing computer names
$csvFilePath = "c:\dev\zoma.csv"
$groupName = "SGG-GPF-ApplockerAppcontrol-DisableAppLocker"
try {
# Import CSV file
$computers = Import-Csv $csvFilePath
foreach ($computer in $computers) {
$computerName = $computer.Name
# Check if computer is part of the specified group
if (Get-ADComputer -Filter {Name -eq $computerName} | Get-ADPrincipalGroupMembership | Where-Object {$_.Name -eq $groupName}) {
Write-Host "$computerName is part of the $groupName group."
} else {
Write-Host "$computerName is not part of the $groupName group."
}
}
} catch {
Write-Host "An error occurred: $_"
}
Editor is loading...
Leave a Comment