$serverlist = Import-Csv '.\intune\Proactive Remediations\Tenable-AgentStatus\servers.csv'

foreach ($server in $serverlist) {
    $serverName = $server.ServerName
    $cred = $server.Credential
    $session = New-PSSession -ComputerName $serverName -Credential $cred
    Invoke-Command -Session $session -ScriptBlock { 
        param($serverName)
        .\intune\Proactive Remediations\Tenable-AgentStatus\remediate-agent.ps1
    } -ArgumentList $serverName
    Remove-PSSession -Session $session
}
