0

Is it possible to get the LastBootUpTime of a remote machine (running Windows) if you have not been granted access to that server; though the server is on the same network, and same domain as the client?

It is possible to get a list of permissions on the box even if you have not been granted access to the machine (example powershell below), so I'm hoping it's not entirely foolish to suspect that there may be some way to get similar data on up time... especially if after a boot the computer updates some AD attribute, such as a LastLogonTimestamp or similar?

([adsi]'WinNT://myServerName/Administrators, group').psbase.Invoke("members") `
| %{$_.GetType.Invoke().InvokeMember("Name",'GetProperty', $null, $_, $null)}

I've also written code (PowerShell and C#) to retrieve a server's last boot up time where the current user does have permissions on the remote machine.

$arrayOfServers | Get-CimInstance Win32_OperatingSystem | select csname, lastbootuptime

See my solution to related question on SO for more examples: https://stackoverflow.com/questions/22965686/how-to-get-last-boot-time-of-a-remote-system-in-c-sharp-or-vb-with-a-non-admin-u/52478378#52478378

1
  • Can you not do something like > SystemInfo /s remote_machine | find "Boot Time:" Sep 24, 2018 at 13:29

1 Answer 1

2

No, but you could enable WMI for a non-administrator user to limit the scoop of the permission gave, but that mean an administrator will need to enable the user.

Allowing Users Access to a Specific WMI Namespace

You can allow or disallow users access to a specific WMI namespace by setting the "Remote Enable" permission in the WMI Control for a namespace. If a user tries to connect to a namespace they are not allowed access to, they will receive error 0x80041003. By default, this permission is enabled only for administrators. An administrator can enable remote access to specific WMI namespaces for a nonadministrator user.

The following procedure sets remote enable permissions for a non-administrator user.

To set remote enable permissions

Connect to the remote computer using the WMI Control.

For more information about the WMI Control, see Setting Namespace Security with the WMI Control.

In the Security tab, select the namespace and click Security.

Locate the appropriate account and check Remote Enable in the Permissions list.

More about that topic here

After the settings, you could launch WMI query, as such;

In command prompt;

wmic /node:"<computer>" OS get LastBootUpTime

In powershell;

Get-WmiObject Win32_OperatingSystem -ComputerName <computer> | fl LastBootUpTime

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .