Skip to content

Instantly share code, notes, and snippets.

@kbbgl
Created May 7, 2020 17:07
Show Gist options
  • Select an option

  • Save kbbgl/4288574a02dcecb65bf8da6754650174 to your computer and use it in GitHub Desktop.

Select an option

Save kbbgl/4288574a02dcecb65bf8da6754650174 to your computer and use it in GitHub Desktop.
[Windows | run remote commands] #windows #remote
# Enable remoting on server where RPC will run in
Enable-PSRemoting -Force
# Check if WinRM is running on remote server
Test-WsMan QUERY_NODE1_HOSTNAME
$username = "corp\myuser"
$password = ConvertTo-SecureString -String "mypswd" -AsPlainText -Force
$cred = [pscredential]::new($username,$password)
$args = "-t", "list_only"
$parameters = @{
ComputerName = "s1", "s2"
ScriptBlock = { & "C:\scripts\elasticube_data_cleaner_11Feb2019 Update\elasticube_data_cleaner.exe" -t "list_only" }
Credential = $cred
}
Invoke-Command @parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment