Hi All, am new to PS scripting, i have a small requirement , i need to update mcafee dat on multiple remote servers without login to them, so with PS script i tried with following code but it is not working , can someone help me to correct this.
$RemoteServers = Get-Content "c:\logs\McAfee\Servers.txt"
@(
foreach ($Server in $RemoteServers)
{
if ( Test-Connection -ComputerName $RemoteServer -Count 1 -ErrorAction SilentlyContinue )
{
$Path='c:\Program Files (x86)\McAfee\VirusScan Enterprise\mcupdate.exe'
$parameters='/update /quiet'
$Path='c:\Program Files (x86)\McAfee\Common Framework\CmdAgent.exe /p'
}
else
{
$Path='C:\Program Files\Mcafee\VirusScan Enterprise\mcupdate.exe'
$Parameters='/update /quiet'
$Path='c:\Program Files\McAfee\Common Framework\CmdAgent.exe /p'
Write-Output "$name is unrechable please check the server either from ilo or VC console"
}
}
)|Out-File -FilePath 'c:\logs\McAfee\McAfe_DAT.
- Edited by Vijay Kumar Myadam 30 minutes ago