-
Notifications
You must be signed in to change notification settings - Fork 2
PS Remote
John Holt edited this page Sep 2, 2019
·
6 revisions
Wiki > The Backend System > Useful tools > Powershell Remote
Remote Powershell can be used on the NDX machines to run arbitrary command line scripts remotely. This could be useful for example if you want to run something as the database admin without having to interrupt instruments running.
WARNING: This is obviously very dangerous - you will have the power to run any commands and could affect the running instrument quite severely.
- Start a PowerShell terminal as administrator (found under
Windows PowerShell
in the Start Menu) - Run
Enable-PSRemoting
you should see an output like:
WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.
WinRM has been updated for remote management.
WinRM firewall exception enabled.
- Run
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value * -Force
. This will allow your machine to access others.
Once the above setup has been done you can use PowerShell Remote as follows:
- Start a PowerShell terminal (does not need to be admin).
- Run
$cred=get-credential
and you will see a pop up box asking for you to input some credentials. - Input the credentials for an instrument admin account (remember to put in an instrument machine as the domain but this can be any instrument machine, the credentials will still work for remote access as long as the machine has the same administrator account).
- Run
Invoke-Command -Credential $cred instrument_machine { command }
, wherecommand
is the PowerShell command or script you'd like to run on the remoteinstrument-machine
(standard DOS commands can be executed with{ cmd /c
command
}).
There are some useful power shell scripts in the isis private share ...private_git_repositories\private_scripts.git
including one that helps remote to instrument machines and run the same command.