Page 1 of 1

Display Network-Infos

Posted: December 5th, 2017, 11:07 am
by Straubi
Hello I am new in using Rainmeter.
For display some Network-Info I use Rainmeter.
Most Informatin I found in the SysInfo Plugin.
But I also need "Logonserver" and " LastLogon"
"LogonServer" I find in the Winsows Variables %logonserver%,
but I don´t know how to show in Rainmeter.
I test with RunCommand Plugin, but I don´t get it to work.
Please Help !!!
Thanks

Re: Display Network-Infos

Posted: December 5th, 2017, 11:50 am
by ikarus1969
you can just use "%LOGONSERVER%" in the "Text"-property of a String-meter (or everywhere else where you would use normal variables):

Code: Select all

[Meter_Test]
Meter=STRING
Text="%LOGONSERVER%"
you can read the documentation: https://docs.rainmeter.net/manual/variables/#EnvironmentVariables

Re: Display Network-Infos

Posted: December 5th, 2017, 1:42 pm
by jsmorley
If by "LastLogon" you mean the date and time your user account logged into Windows, that is actually pretty tricky to get.

There is a command line option that you might be able to use:

net user AccountName | findstr /B /C:"Last logon"

Replacing "AccountName" with your account... uhm... name.

That will return something like:
1.png
So you can use the RunCommand plugin and a RegExpSubstitute / Substitute to get the date and time.

HOWEVER...

The issue with this command is that that logon date and time is only set if you actually, literally "log on" to Windows when it restarts. If you have your account set, and many folks do, to skip logging on with a password and just boot straight into Windows, this value will not reflect that. Take a look at that screenshot above. It says I haven't logged on since April.

THERE IS AN ALTERNATIVE...

if you use the command:

quser AccountName

it will return something like:
2.png
HOWEVER...

The issue with this command is that it is only available in the "Professional" versions of Windows 7,8,&10. It won't work on any "Home" versions of the OS.

Other than these two alternatives, I don't know of any way to get this information that Rainmeter can get at, so if you really want to know when a user account "logged on" to Windows, you are going to have to determine which of these will work for you.

If you are running Window "Home" and have your account set to boot to Windows without requiring a password to be entered, you are likely out of luck.

Re: Display Network-Infos

Posted: December 5th, 2017, 2:37 pm
by jsmorley
There is another alternative that might work.

If you go to this site:

https://docs.microsoft.com/en-us/sysinternals/downloads/psloggedon

And download the .zip file near the bottom of the page, you will be able to get the Microsoft Sysinternals command line tool called PSLoggedOn.exe.

That can be called with:

psloggedon | findstr /C:"AccountName"

If you use that utility with the RunCommand plugin, you can get a result like:
3.png
That will also display accurate logon time information, and doesn't require Windows "Pro".

Re: Display Network-Infos

Posted: December 5th, 2017, 3:57 pm
by jsmorley
Here is an example .rmskin that demonstrates how you might use the PsLoggedon.exe utility.
AccountLogon_1.0.rmskin
(74.35 KiB) Downloaded 32 times
1.png

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureAccountTime "Run"]

; The account name of the current user
[MeasureUser]
Measure=Plugin
Plugin=SysInfo
SysinfoType=USER_NAME

; The current time
[MeasureCurrentTime]
Measure=Time

; The current system uptime in seconds and format
[MeasureUptime]
Measure=Uptime
Format="%4!i!d %3!i!h %2!i!m %1!i!s"

; Gets and parses the psloggedon command to get the date and time 
; when the current user account logged onto Windows
[MeasureAccountTime]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Parameter="""#@#psloggedon" | findstr /C:"[MeasureUser]"""
RegExpSubstitute=1
Substitute="(?siU)^.*([\d]{1,2}/[\d]{1,2}/[\d]{4} [\d]{1,2}:[\d]{1,2}:[\d]{1,2} [\w]{2}).*$":"\1"
; On my system / locale the result is:
;     12/4/2017 11:02:10 AM    	TOWER\Jeffrey
; Your mileage may vary, and you might have to adjust the Substitute option.
FinishAction=[!UpdateMeasureGroup "Account"]

; Calculate the date and time the system was restarted
; Format as a pretty string output
[MeasureUptimeString]
Measure=Time
TimeStamp=([MeasureCurrentTime:]-[MeasureUptime:])
Format=%A, %B %#d, %Y at %I:%M:%S %p
DynamicVariables=1

; Format the date and time the current user account logged onto Windows
[MeasureAccountTimeString]
Measure=Time
Group=Account
TimeStamp=[MeasureAccountTime]
TimeStampFormat=%#m/%#d/%Y %I:%M:%S %p
Format=%A, %B %#d, %Y at %I:%M:%S %p
DynamicVariables=1

; Calculate the current user account "uptime" in seconds and format
[MeasureAccountUptime]
Measure=Uptime
Group=Account
SecondsValue=([MeasureCurrentTime:]-[MeasureAccountTimeString:Timestamp])
Format="%4!i!d %3!i!h %2!i!m %1!i!s"
DynamicVariables=1

[MeterUptimeText]
Meter=String
FontSize=12
FontWeight=700
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=System Restarted

[MeterUptimeString]
Meter=String
MeasureName=MeasureUptimeString
Y=R
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1

[MeterUptimeFormat]
Meter=String
MeasureName=MeasureUptime
Y=R
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Elapsed: %1

[MeterAccountText]
Meter=String
Y=10R
FontSize=12
FontWeight=700
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Account Logon

[MeterAccountString]
Meter=String
MeasureName=MeasureAccountTimeString
Y=R
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1

[MeterAccountFormat]
Meter=String
MeasureName=MeasureAccountUptime
Y=R
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Elapsed: %1
https://docs.rainmeter.net/manual-beta/measures/uptime/
https://docs.rainmeter.net/manual-beta/plugins/runcommand/
https://docs.rainmeter.net/manual-beta/measures/time/

Re: Display Network-Infos

Posted: December 6th, 2017, 7:03 am
by Straubi
Hi. Thanks for the Help.
But my first problem.

[Meter_Test]
Meter=STRING
Text="%LOGONSERVER%"

will result with "%LOGONSERVER%"
and not with the servername.
I forget something?

Re: Display Network-Infos

Posted: December 6th, 2017, 9:48 am
by ikarus1969
Straubi wrote:Hi. Thanks for the Help.
But my first problem.

[Meter_Test]
Meter=STRING
Text="%LOGONSERVER%"

will result with "%LOGONSERVER%"
and not with the servername.
I forget something?
Can you please post the code of the skin that is not working? It would be easier to investigate what is going wrong.

could you do us a favour? When posting code please mark the code and press the "Code"-Button above the posting-window. With that your skin-code will be embedded in a special tag that makes the code easier to read and copied. Thank you!

Re: Display Network-Infos

Posted: December 6th, 2017, 12:29 pm
by jsmorley
Straubi wrote:Hi. Thanks for the Help.
But my first problem.

[Meter_Test]
Meter=STRING
Text="%LOGONSERVER%"

will result with "%LOGONSERVER%"
and not with the servername.
I forget something?
Not sure. Works for me.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%LOGONSERVER%
1.png
You might want to go out to a cmd.exe console and type "set" and make sure you have the variable set in Windows.

Re: Display Network-Infos

Posted: December 7th, 2017, 5:42 am
by Straubi
OK. Thanks.
Now it works. Don´t know why.
But it works.