Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

deploy when in a lock state

Is there a way to deploy a program or batch file when the remote computers screen is locked? I see you can select logged on or off but not in a log state.

0

Comments

1 comment
Date Votes
  • Powershell is your friend...

    function GetRemoteLogonStatus ($computer = 'localhost') { 
    if (Test-Connection $computer -Count 2 -Quiet) { 
        try { 
            $user = $null 
            $user = gwmi -Class win32_computersystem -ComputerName $computer | select -ExpandProperty username -ErrorAction Stop 
            } 
        catch { "Not logged on"; return } 
        try { 
            if ((Get-Process logonui -ComputerName $computer -ErrorAction Stop) -and ($user)) { 
                "Workstation locked by $user" 
                } 
            } 
        catch { if ($user) { "$user logged on" } } 
        } 
    else { "$computer Offline" } 
    }
    0