Jump to content

Check the current pc state


Recommended Posts

I want to check that the pc is not logged in so I can run some software installations via another process. I guess it might fall into the category of the pc being idle. But I just need the machine to be up and at the three finger solute screen. Can anyone help. I don't even know where to start.

Link to comment
Share on other sites

Your suggestion was definately helpful but is there a way to get a similar result with an autoit script. Much like the results of psloggedon.exe I want to detect that no one is logged in, then trigger an installation. I have the installation script ready to go but have no clue on addressing the most important piece.

Thanks. I appreciate that. I'll give it a try.

Link to comment
Share on other sites

Your suggestion was definately helpful but is there a way to get a similar result with an autoit script. Much like the results of psloggedon.exe I want to detect that no one is logged in, then trigger an installation. I have the installation script ready to go but have no clue on addressing the most important piece.

Perhaps something along these lines.

Global $objWMIService = 0

Global $strComputer,$colEvents,$np

    $strComputer = "."
    If $objWMIService = 0 Then $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

    $colEvents = $objWMIService.ExecQuery _
            ("Select * from Win32_PerfRawData_PerfNet_Server")
    
    For $objClass in $colEvents
        msgbox(0,"Serversession",$objClass.ServerSessions)
    Next
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 5 weeks later...

This piece of script shows me the current logged in user for my pc. How do I get it to read a remote pc registry to test the setting. I think this could be the setting I need to validate if "anyone" is logged on to a remote workstation before I run my anti virus installation and reboot.

$value = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AltDefaultUserName")

Msgbox(64, "Value", $value)

Perhaps something along these lines.

Global $objWMIService = 0

Global $strComputer,$colEvents,$np

    $strComputer = "."
    If $objWMIService = 0 Then $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

    $colEvents = $objWMIService.ExecQuery _
            ("Select * from Win32_PerfRawData_PerfNet_Server")
    
    For $objClass in $colEvents
        msgbox(0,"Serversession",$objClass.ServerSessions)
    Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...