to update DAT file of mcafee on remote computers

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Dan Potter Dan Potter 1 year, 7 months ago.

  • Author
    Posts
  • #32923
    Profile photo of Srikanth Byram
    Srikanth Byram
    Participant

    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

  • #32930
    Profile photo of tommymaynard
    tommymaynard
    Member

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

  • #32945
    Profile photo of Christian Sandfeld
    Christian Sandfeld
    Participant

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

  • #32977
    Profile photo of Srikanth Byram
    Srikanth Byram
    Participant

    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 .

  • #32980
    Profile photo of Dan Potter
    Dan Potter
    Participant

    $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"}

    }

  • #33034
    Profile photo of Srikanth Byram
    Srikanth Byram
    Participant

    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

  • #33036
    Profile photo of Dan Potter
    Dan Potter
    Participant

    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}

    [Diagnostics.Process]::Start($execute,$parameters).WaitForExit()

You must be logged in to reply to this topic.