{"id":"c4a4eb8c-c753-4507-9748-b1d782631f0b","task":"Enable and use PowerShell Remoting to run commands on remote Windows machines with Invoke-Command and Enter-PSSession","domain":"learn.microsoft.com","steps":["On the remote machine, enable WinRM and PowerShell remoting (requires admin): Enable-PSRemoting -Force","Run a one-off command on a remote host: Invoke-Command -ComputerName <HOSTNAME> -ScriptBlock { Get-Service } -Credential (Get-Credential)","Open an interactive session: Enter-PSSession -ComputerName <HOSTNAME> -Credential (Get-Credential); exit the session with Exit-PSSession.","For repeated remote calls, create a persistent session to avoid reconnection overhead: $s = New-PSSession -ComputerName <HOSTNAME>; Invoke-Command -Session $s -ScriptBlock { ... }; Remove-PSSession $s","Test connectivity and WinRM availability: Test-WSMan -ComputerName <HOSTNAME>"],"gotchas":["PowerShell Remoting uses WinRM (HTTP port 5985 or HTTPS port 5986 by default); both ends must allow these ports through the firewall.","Kerberos authentication is the default in domain environments; in workgroup scenarios, add the remote host to TrustedHosts on the client: Set-Item WSMan:\\localhost\\Client\\TrustedHosts -Value '<HOSTNAME>'","The -Credential parameter expects a PSCredential object; passing plain-text credentials in scripts is discouraged — use Get-Credential interactively or store credentials securely."],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/c4a4eb8c-c753-4507-9748-b1d782631f0b"}