I have a small script that checks the communication date of the mcafee agent.
$GetLastCommunication = & "C:\Program Files\McAfee\Agent\cmdagent" -i | Select-String -Pattern LastASCTIME | Out-String
$GetLastCommunication = $GetLastCommunication.Replace("`n", "").Replace("`r", "").Replace(" ","")
Start-Job -ScriptBlock {
$newagentdir = (Get-ChildItem -Recurse "\\IP\Downloads\" -Include "FramePkg.exe").FullName
$arg = "/forceinstall /install=agent /silent"
Copy-Item -Path $newagentdir -Destination $env:TEMP
Start-Process -Wait $env:TEMP\FramePkg.exe -ArgumentList $arg
}
while ($GetLastCommunication = "LastASCTime:N/A"){
sleep -Seconds 5
}
Reload-Form
after the installation, the LastASCTime line changes from N/A to the time of communication.
I need for him to check when the variable changes and then reloads the form when there’s communication.
Currently, is getting stuck in the while loop and doesn’t reload the form.
Any ideas why?
Thanks