Highlighted
Super Contributor.
Super Contributor.
831 views

Last logon Windows user

Hi Team,

 

I have created a view and would like to pull a report for the last logon user into a windows system.

 

We have Windows, IP, Windows user, CPU etc.

 

How do we pull the last user who has logged into a windows box? I have generated the users present in the box like admin, user1, user2 etc and also checked the last access time but the requirement is to find the last user who logged into the windows box.

 

Is there a way to do this?

 

Regards

Mathew

0 Likes
4 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: Last logon Windows user

Hi,

 

There are users logins (hwOSUserProfileName and hwOSUserProfileLastLogon) in the scan file. But the UCMDB does not retrieve this information.

 

I thought about Custom Hardware Mapping to extract this information form scan file but it not work.

 

I plan to write a function (in ParseEnrichedScanFile.py) to extract this information and create new objects for hwOSUserProfiles.

 

But it's no good idea, because this file overwrite after CUP or CP deployed.

 

 

Best Regards, Sergy.
0 Likes
Highlighted
Established Member..
Established Member..

Re: Last logon Windows user

Hi, firstly which discovery integration/adapter are you running to try retrieve?

This information is available in WMI class Win32_NetworkLoginProfile

you could easily adapt one of the jobs or write your own discovery adapter to enrich your CI's with this information.
0 Likes
Highlighted
Regular Contributor.. Regular Contributor..
Regular Contributor..

Re: Last logon Windows user

Hi Mathew,

I was having similar issue with Last Logon. If you run Host Connection by WMI the "Win32_ComputerSystem" WMI Class can pull UserName (the Name of a user that is logged currently).

1st : You can use the NODE attribute USER LABEL or create a new NODE attribute

[Display Name : "Last Logon User" and Name : "last_logon_user"]

2nd : Edit the "WMI_Connection_Utils.py" and add the following script inside the if statement for 'Win32_ComputerSystem' Class Query (around line 321)

_wmiQuery2 = 'select Manufacturer,NumberOfProcessors,Model,Domain,UserName from Win32_ComputerSystem'

CurrentLoggedOn = resultSet.getString(5)
hostOSH.setStringAttribute('last_logon_user', CurrentLoggedOn)

3rd : Save it and then Run the Host Connection by WMI

Hope this should resolve your issue.

Thanks.

Zubaer Siddique

 

 

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: Last logon Windows user

Hi Siddique,

I have followed the below steps to pull the Last logged user from Win32_ComputerSystem. But it is not pulling any user data.

 

Please help.

 

Thanks

Priyanka

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.