Jump to content

Recommended Posts

Posted

A teacher has asked if it's possible to permantently show the username of who's logged in by showing the username or name at one of the 4 corners of the screen which would sit above in front of all the other windows.

 

All i can think of is BGInfo but we are already using the background for other things.

 

Has anyone come across anything like this?

Posted

BGInfo with the /taskbar switch? The user has to click it for it to display the info, so assuming your use case is a teacher prowling around checking Fred isn't logged in as Eric, it doesn't really meet the need.

 

Build an .exe that runs on launch, pulling the value from AD and runs minimised in the taskbar, with the window title set to the value you pull?

  • Thanks 1
Posted

This autoit script should do what you want (username box at the top left of the screen). You just need to compile it into an exe and have it run at login.

;Libraries and Variables to Include
#include 
;Create text window.
SplashTextOn("User", @username, 200, 50, 10, -30, $DLG_CENTERONTOP, "", 22)
while ProcessExists ( "explorer.exe" ) ; keeps window open while windows shell is running.
wend
SplashOff()

 

If you want to change it around then the documentation is here.

https://www.autoitscript.com/autoit3/docs/functions/SplashTextOn.htm

  • Thanks 1
Posted
This autoit script should do what you want (username box at the top left of the screen). You just need to compile it into an exe and have it run at login.

;Libraries and Variables to Include
#include 
;Create text window.
SplashTextOn("User", @username, 200, 50, 10, -30, $DLG_CENTERONTOP, "", 22)
while ProcessExists ( "explorer.exe" ) ; keeps window open while windows shell is running.
wend
SplashOff()

 

If you want to change it around then the documentation is here.

https://www.autoitscript.com/autoit3/docs/functions/SplashTextOn.htm

 

I would suggest adding the line:

#NoTrayIcon

to the top of that script, just so the students can't close the program via the System Tray.

  • Thanks 2
Posted
Never used auto it before. Would AutoIt have to be installed on each machine too?

 

AutoIt only needs to be installed on your machine, then you can compile your code into an exe and run it on any of the computers you wish without additional software.

  • Thanks 2
Posted
Thank you for this... next question. I don't like it in the corner, is there a way to get it in the middle or the middle of the screen? We have different screen sizes around our place.
Posted
Thank you for this... next question. I don't like it in the corner, is there a way to get it in the middle or the middle of the screen? We have different screen sizes around our place.

 

SplashTextOn("User", @username, 200, 50, -1, -1, $DLG_CENTERONTOP, "", 22)

 

Would change it so the text is in the centre of the screen.

  • Thanks 2
Posted
We've got a piece of software that runs at startup which pulls logon data from a spreadsheet and shows their username in the taskbar :)

Wouldn't mind having a look please.

 

Back to autoit? Can the username be placed in the taskbar maybe? Struggling to find an appropriate place on screen as where ever its placed it covers something.

Posted
Wouldn't mind having a look please.

 

Back to autoit? Can the username be placed in the taskbar maybe? Struggling to find an appropriate place on screen as where ever its placed it covers something.

 

The best that can be done is this:

 

[b]#NoTrayIcon
$WidthFromRight = 600
$HeightFromBottom = 40
$XPos = @deskTopWidth - $WidthFromRight
$YPos = @deskTopHeight - $HeightFromBottom[/b]
;Libraries and Variables to Include
#include 
;Create text window.
SplashTextOn("User", @username, 200, [b]40[/b], [b]$XPos[/b], [b]$YPos[/b], [b]1[/b], "", [b]10[/b])
while ProcessExists ( "explorer.exe" ) ; keeps window open while windows shell is running.
wend
SplashOff()

 

Which will place it on top of the taskbar... until someone clicks on the Taskbar, in which case the Taskbar will be on top (as it has an always on top setting too), but you should see it transparently through the taskbar.

Posted

Many thanks for your help. I think i've found a suitable place, up near the minimize buttons.

 

One last question.. is there a way to show First Name Surname rather than using @username to show the username?

Posted
Many thanks for your help. I think i've found a suitable place, up near the minimize buttons.

 

One last question.. is there a way to show First Name Surname rather than using @username to show the username?

 

Try adding this line...

$DisplayName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", "LastLoggedOnDisplayName")

 

Then changing the @ username entry to $DisplayName

Posted
Try adding this line...

$DisplayName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", "LastLoggedOnDisplayName")

 

Then changing the @ username entry to $DisplayName

 

That doesn't work, sorry, it's giving just a blank box :(.

Posted

It's a bit more scripting but you could use WMI. Put this on the start and use the $displayname variable.

 

$WMI = ObjGet("WinMgmts:root/cimv2")
$colQuery1 = $WMI.ExecQuery("Select UserName FROM Win32_ComputerSystem")
For $item In $colQuery1
$ID = $item.UserName
Next
$colQuery2 = $WMI.ExecQuery("Select * FROM Win32_NetworkLoginProfile")
For $object In $colQuery2
If $object.Name = $ID Then
$DisplayName = $object.Fullname
EndIf
Next

Posted
That doesn't work, sorry, it's giving just a blank box :(.

 

I guess your running this on 64-Bit then?

 

This should work on 64-Bit.

$DisplayName = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", "LastLoggedOnDisplayName")

  • Thanks 1
Posted

After this has been out there for less than a day, it's already causing issues.

 

Where i placed, i thought nothing will be placed in that area of the screen, then they all open photoshop to be told that the name box is covering part of the menu system in the top right.

 

So, is there a way to make the grey box transparent and the underneath of the box clickable?

Posted
After this has been out there for less than a day, it's already causing issues.

 

Where i placed, i thought nothing will be placed in that area of the screen, then they all open photoshop to be told that the name box is covering part of the menu system in the top right.

 

So, is there a way to make the grey box transparent and the underneath of the box clickable?

 

Not really, no. The closest you could get would be by the taskbar, but that could be covered by applications and as I said before it 'will place it on top of the taskbar... until someone clicks on the Taskbar, in which case the Taskbar will be on top (as it has an always on top setting too), but you should see it transparently through the taskbar.'

 

You could try the code below though and see if it will work the way you want it too.

 

 

#NoTrayIcon
$DisplayName = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", "LastLoggedOnDisplayName")$WidthFromRight = 600
$HeightFromBottom = 40
$XPos = [i]@[/i]DeskTopWidth - $WidthFromRight
$YPos = [i]@[/i]DeskTopHeight - $HeightFromBottom
;Libraries and Variables to Include
#include 
;Create text window.
SplashTextOn("User", $DisplayName, 200, 40, $XPos, $YPos, 1, "", 10)
while ProcessExists ( "explorer.exe" ) ; keeps window open while windows shell is running.
wend
SplashOff()

Posted

I tried the taskbar option, this too wasn't great and the ones who requested this would moan at it being too hard to see.

 

Never mind, i might see if the teachers could do something with impero as and when they need this exe.as all teachers won't require it.

Posted
I tried the taskbar option, this too wasn't great and the ones who requested this would moan at it being too hard to see.

 

Never mind, i might see if the teachers could do something with impero as and when they need this exe.as all teachers won't require it.

 

Does Impero not tell you the console session user anyway?

Seems like something I'd imagine it would do. NetSupport does.

  • 5 weeks later...
Posted

Thanks for the tips above.

I have added the code for display name in the script below if anyone needs it.

Image1.png

 

#NoTrayIcon
;Libraries and Variables to Include
#include 

; Pixels foro top right of screen
$WidthFromRight = 400
$XPos = @deskTopWidth - $WidthFromRight

; Function to get display name of the currently logged in user.
Func GetFullName($sUserName)
   $colItems = ""
   $strComputer = "localhost"

   $objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
   $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

   If IsObj($colItems) then
      For $objItem In $colItems
         Return $objItem.FullName
      Next
   Else
      Return SetError(1,0,"")
   Endif
EndFunc

;Create text window.
SplashTextOn("User", GetFullName(@UserName), 200, 16, $XPos, -27, 32, "", 10)
while ProcessExists ( "explorer.exe" ) ; keeps window open while windows shell is running.
wend
SplashOff()

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



×
×
  • Create New...