Created
November 10, 2021 21:18
-
-
Save VVX7/04a0f71c66b3fdc10bf4d0d07f614d61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[ | |
Author: Roger Johnston, Twitter: @VV_X_7 | |
License: Apache 2.0 | |
Use `NetWkstaGetInfo` to get info about a workstation config. | |
References: | |
- https://docs.microsoft.com/en-ca/windows/win32/api/lmwksta/nf-lmwksta-netwkstagetinfo | |
- https://docs.microsoft.com/en-us/windows/win32/api/lmwksta/ns-lmwksta-wksta_info_102 | |
]# | |
import winim, strformat | |
var | |
servername: LMSTR = "DESKTOP-FJD1TMK" | |
level: DWORD = 102 | |
buffer: LPBYTE | |
nStatus: NET_API_STATUS | |
nStatus = NetWkstaGetInfo(servername, level, &buffer) | |
if nStatus == NERR_Success: | |
let info102 = cast[LPWKSTA_INFO_102](buffer) | |
echo fmt"Platform: {info102.wki102_platform_id}" | |
echo fmt"Version: {info102.wki102_ver_major}.{info102.wki102_ver_minor}" | |
echo fmt"Name: {info102.wki102_computername}" | |
echo fmt"Domain: {info102.wki102_langroup}" | |
echo fmt"LAN Root: {info102.wki102_lanroot}" | |
echo fmt"Logged on users: {info102.wki102_logged_on_users}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment