cls
# Get all local users named "LocalAdmin"
$local_users = Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'" | Where-Object { $_.Name -like "LocalAdm*" }
# Iterate over the local users
foreach ($user in $local_users) {
$user.Name
# Delete the user if its name starts with "LocalAdmin"
net user $user. Name /delete
}
Комментариев нет:
Отправить комментарий