Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Script:
# Define the remote computer name
$remoteComputer = "RemoteComputerName"
# Create a session to the remote computer
$session = New-PSSession -ComputerName $remoteComputer
# Enable WinRM service on the remote computer
Invoke-Command -Session $session -ScriptBlock {
# Enable the WinRM service
Enable-PSRemoting -Force
# Set the WinRM service to start automatically
Set-Service -Name "WinRM" -StartupType Automatic
# Start the WinRM service
Start-Service -Name "WinRM"
}
# Close the session
Remove-PSSession -Session $session
Write-Host "WinRM has been enabled on the remote computer: $remoteComputer"
How to Run the Script:
Enable-WinRM.ps1
."RemoteComputerName"
with the actual name or IP address of the remote computer you want to configure..\Enable-WinRM.ps1
in your PowerShell window.