Welcome to the community forums for Theopenem. All responses are provided by other users that wish to help out. Theopenem will not respond to these posts. If you require more assistance than what the community can provide, we offer various paid support options.


  • I am trying to make a policy that runs on login for one particular user and shows a "Warning" message to that user. Login policies should run in the context of logged in users, so I created a PS script that checks who is logged in with this:

    # Get the currently logged-in user
    $currentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
    
    # Check if the username is "user"
    if ($currentUserName -eq "user") {
        Write-Host "Logged in user is 'user'."
        exit 0
    } else {
        Write-Host "Logged in user is not 'user'. Logged in user is '$currentUserName'."
        exit 1
    }
    
    

    and used it as a Condition script for policy and/or module. But the condition always fails with MarkNotApplicable.
    I could make an Impersonation account for this one, but

    Second problem is that when I tried to use "Send Message" to that PC, it output an error:

    ERROR [45] ApiRequest - Error Retrieving API Response: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:9000
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.GetResponse()
       at RestSharp.Http.<ExecuteRequest>g__GetRawResponse|185_1(WebRequest request)
       at RestSharp.Http.ExecuteRequest(String httpMethod, Action`1 prepareRequest)
    

  • I tried your script, I set it as a condition for a login policy and it works fine for me. However, there is an issue with the message modules when set to run with a login policy, it looks like I only set it up to work with checkin/startup policies, and it results in the toec-ui crashing. That is most likely why you are seeing the error you posted, it indicates that toec-ui is not running. I'll need to fix this in the next release.