Files
DevOps/Proxmox/stopFileserver.ps1
2025-10-25 13:21:06 +02:00

14 lines
517 B
PowerShell

# Define variables
$hostname = "192.168.50.200" # "your_linux_server_ip_or_hostname"
$username = "root"
$command = "/usr/bin/echo test >> /root/test" # Replace with the command you want to run
# Create a new SSH session
$session = New-PSSession $username@$hostname -SSHTransport #-HostName $hostname -UserName $username -SSHTransport
# Run the command on the remote server
Invoke-Command -Session $session -ScriptBlock { $command } # -ArgumentList $command
# Close the session
Remove-PSSession -Session $session