Zum Inhalt springen
Powershell Remote

Powershell Remote

Hostsystem einrichten

Enable-PSRemoting -force
cd wsman:
Set-Item WSMan:\localhost\Client\TrustedHosts <CLIENT_IP>
restart-Service winrm

Clientsystem

Passwort verschlüsselt hinterlegen

Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File C:\Password.txt

Credential-Variable erzeugen

$password = type C:\Password.txt | ConvertTo-SecureString
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist "Administrator",$password

Befehl ausführen

invoke-command <HOSTSYSTEM_IP> -Credential $cred -scriptblock {systeminfo}

Oder eine interaktive Remote Shell starten:

enter-PSSession <HOSTSYSTEM_IP> -Credential $cred
Zuletzt aktualisiert am