How to show all users or last logon user in Windows 8 (VBScript)  

Introduction

This script sample shows how to show all users or last login user in Windows 8.

Scenarios

Sometimes users want to show all user on login screen. This script is to achieve that.

Script

Step 1: Double click the script and it will show a UAC.

Step 2: Press Yes to continue, then there is a message box. Select what you want.

Step 3: After that, you can get a message.

Note

1. After script executes, it will take effect when you restart the computer or logoff.

2. Do not delete TakeOwnerShip.ps1 file, otherwise it will show an error.

Here are some code snippets for your reference.

VBS
Edit|Remove
set oShell = CreateObject("WScript.Shell")
oShell.Run "PowerShell -nologo " & PsPath , 0, True
' Create a temp file with the script that regini.exe will use
strFileName = FSO.GetTempName
set oFile = FSO.CreateTextFile(strFileName)
oFile.WriteLine "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\UserSwitch [2 8 19]"
oFile.WriteLine "Enabled = REG_DWORD 1"
oFile.WriteLine "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
oFile.WriteLine "AutoAdminLogon = REG_SZ 0"
oFile.Close


'    Change registry permissions with regini.exe
set oShell = CreateObject("WScript.Shell")
oShell.Run "regini " & strFileName, 0, true



Prerequisite 

Windows 8 or later version

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.