
도메인에 일부 클라이언트가 있고 일부는 그렇지 않습니다. 특정 로컬 사용자가 있는 클라이언트를 검색한 다음 삭제하는 방법을 알아야 합니다. 도메인 클라이언트의 경우 GPO를 사용하는 것이 매우 쉽지만 비도메인 클라이언트의 경우는 어떻습니까? Powershell 명령을 알고 있습니다.Get-LocalUser그리고삭제-로컬사용자, 하지만 모든 PC에서 실행하고 싶지는 않습니다. 도움이 될 수 있는 스크립트를 알고 계십니까?
감사해요
답변1
PSRemoting을 활성화해야 합니다(작업 그룹 모드) 도메인이 아닌 컴퓨터에서 원격을 사용하여 이 작업을 수행할 수 있으며 해당 시스템에는 최신 PSv5가 있거나 MS powershellgallery.com의 로컬 사용자 관리용 모듈이 있어야 합니다.
원격을 설정하려면 여전히 각 컴퓨터를 터치해야 합니다.
•독립 실행형(작업 그룹) 컴퓨터에서 PowerShell Remoting 활성화
•독립 실행형 작업 그룹 컴퓨터 간 PowerShell PS 원격
각 기사를 읽어보면 모든 세부 사항을 알 수 있습니다. 단, 요약하자면 다음과 같습니다.
### Remote Computer
NetConnectionProfile -NetworkCategory Private
Enable-PSRemoting -SkipNetworkProfileCheck -Force
Set-NetFirewallRule –Name "WINRM-HTTP-In-TCP-PUBLIC" –RemoteAddress Any
### Local computer
# Review teh trusted host file
Get-Item WSMan:\localhost\Client\TrustedHosts
# Set the trusted a specific target
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "10.0.2.33" -Force
# Or for several hosts if you don't want to specify them individually
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
# Connect to a host
Enter-PSSession -ComputerName 10.0.2.33 -Credential $Credentials
실행할 수 있는 몇 가지 PowerShell 명령이 있습니다.원격을 활성화하지 않고:
•Remoting 또는 WinRM을 사용하지 않고 Windows PowerShell을 사용하여 원격으로 작업
Get-WinEvent
Get-Counter
Get-EventLog
Clear-EventLog
Write-EventLog
Limit-EventLog
Show-EventLog
New-EventLog
Remove-EventLog
Get-WmiObject
Get-Process
Get-Service
Set-Service
Get-HotFix
Restart-Computer
Stop-Computer
Add-Computer
Remove-Computer
Rename-Computer
Reset-ComputerMachinePassword
또는 MS Sysinternals PSExec.exe 도구를 사용하십시오.