Rechercher dans ce blog

jeudi 5 avril 2018

WinRM, Enable service, Start, and connect remote on the system Windows 7





$computer = "xxxxxxxxxx"
Set-Service winrm -ComputerName $computer -StartupType Automatic
get-service -ComputerName $computer -Name winrm | Start-Service
Invoke-WmiMethod -Class Win32_Process -Name create -ArgumentList "powershell.exe enable-psremoting -force" -ComputerName $computer
Invoke-WmiMethod -Class Win32_Process -Name create -ArgumentList "powershell.exe set-executionpolicy RemoteSigned -force" -ComputerName $computer
sleep -Seconds 30
Enter-PSSession -ComputerName $computer