how do i get this to work ? here is the script can someone help fix it i am trying to check if these process are running if running then skip ending onedrive or else stop onedrive
@("outlook", "word") |
ForEach-Object
{
if(($p=(Get-Process $_ -ErrorAction SilentlyContinue)) -eq $null)
{Write-Host "$_ not running"}
else
{Write-Host "$($p.Description) is running"}
if (Get-Process $_ -ErrorAction SilentlyContinue) = true
else { Stop-Process -name OneDrive }
}