to update DAT file of mcafee on remote computers

hi all,

i wanna execute this “C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcupdate.exe” on remote computers through powershell script …

here is my script which doesn;t give any error and no result with it . let me know if any corrections required .

Function Mcafeeudpate ($cn){$ping=New-Object System.Net.NetworkInformation.Ping
$reply=$null
$cn=Get-Content ‘C:\users\dt203976\Desktop\Mcafee update.txt’
$cn=$cn.trim()
$reply=$ping.send($cn)
if (reply.status -eq “success”){
Invoke-Command -ComputerName $cn -ScriptBlock {C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcudapte.exe}
else
{Write-Output “$cn : is not pingable”}
}
}

OS version : win7 ,64-bit

At first glance, reply.status in the conditional portion of your If-Else should be $reply.status.

And a typo in your scriptblock where you call “mcudapte.exe” (I assume you meant to call mcupdate.exe)

thank you, tommy and christian in replying to this .

i have made the typo error corrections even then i couldn’t succeeded in getting the results from above script .

i have one more script for the same can you help me on below error i have got from this script.

script .

$cn=Test-Connection -ComputerName (Get-Content ‘C:\users\dt203976\Desktop\Mcafee update.txt’) -AsJob
if ($cn.jobstateinfo.state -eq “running”){
Invoke-WmiMethod -class win32_process -name create -ComputerName $cn -ArgumentList “cmd /c C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcupdate.exe”
}
else
{Write-Output “$cn : is not pingable”}

error .

Invoke-WmiMethod : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:3 char:1

  • Invoke-WmiMethod -class win32_process -name create -ComputerName $cn -ArgumentLi …
  •   + CategoryInfo          : InvalidOperation: (:) [Invoke-WmiMethod], COMException
      + FullyQualifiedErrorId : InvokeWMICOMException,Microsoft.PowerShell.Commands.InvokeWmiMethod
    
    
    

note : RPC service is running on both source and target machine .

$servernames = Get-Content ‘C:\users\dt203976\Desktop\Mcafee update.txt’

foreach($server in $servernames){

if(Test-Connection -ComputerName $server -quiet -count 1){

Invoke-WmiMethod -class win32_process -name create -ComputerName $server -ArgumentList “cmd /c C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcupdate.exe”

}else{Write-Output “$server : is not pingable”}

}

thanks potter for helping me on this .

moreover ,initially i thought this mcupdate.exe is not executable on remote computers but even .exe applications like c:\windows\system32\calc.exe or any .txt files residing on remote machines not executables

examples is below

Invoke-Command -ComputerName pndt0033 -ScriptBlock {Invoke-Item ‘c:\windows\system32\calc.exe’}

this command simply says completed but output doesn’t works

guide me on this , am looking for cmdlets to invoke .exe applications and .bat files to run on remote computers

thanks in advance

Years ago when epo was garbage I had a form to do all of this. Epo is a little more dependable these days.

$execute = “c:\eporemediation\psexec.exe”

if ($radiobutton1.Checked){$task = “restartframework.bat”}
if ($radiobutton2.Checked){$task = “mcupdate.bat”}
if ($radiobutton3.Checked){$task = “collectsend.bat”}
if ($radiobutton4.Checked){$task = “framepkg218.exe”}

$parameters = " -c -f -s -d -h -u “+$dnuser+” -p “+$password+” \"+$server+" c:\eporemediation"+$task}