Invoke-Item on A Remote Computer


hello guys , gals,

 

i trying script going allows me start , kill process on remote computer. managed kill part going. asks me info, computer , login id. after finished working on computer want able restart process had killed earlier. reason want able kill process because every , anti-virus software package blocks me being able connect doesn't matter if vnc or rdp.

below script far killing process. 

$comp = read-host "what full computer name?"
$user = read-host "please enter administrator user (domain\user):"
$pwd = read-host "please enter user password:"
tasklist /s $comp /u $user /p $pwd
$program = read-host "program kill"
taskkill /s $comp /u $user /p $pwd /im $program

 

 

 

yeah makes call on rpc, taskill doing.

speaking of which, remove dependecny on external program can this..

 

  gwmi win32_process -computername $comp -filter "name=$program" | %{$_.terminate(0)}  

didnt test it, should work.


justin rich
http://jrich523.wordpress.com
please remember mark replies answers if , unmark them if provide no help.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Azure MFA with Azure AD and RDS

Failed to setup initiator portal. Error status is given in the dump data.

Invalid pointer on gpresult /h gpreport.html