Skip to content

About

Tools to administer a Windows OS computer lab

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

109 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WindowsLab PowerShell Module

WindowsLab lets a LabAdmin manage Windows 10 and 11 computers on the same LAN from one AdminPC. A LabPC is a computer in the selected lab. A LabUser is a local account, such as Student, that the administrator manages across those PCs.

Prepare the lab

On each LabPC, set the lab network profile to Private and enable PowerShell remoting from an elevated Windows PowerShell session. Use computer names that the AdminPC can resolve.

Enable-PSRemoting

For the workgroup setup used in this project, create a local administrator account on each PC with the same username and password. Sign in on the AdminPC with that account. Add the LabPC names to the AdminPC's trusted hosts from an elevated Windows PowerShell session, using your lab's names in the command below.

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'PC01,PC02,PC03' -Concatenate

The optional setup script uses WinGet to install PowerShell 7, sets network profiles to Private and enables remoting when it finds a single private connection. Run it on each PC from the repository root in an elevated Windows PowerShell session. GettingLabReady.ps1

.\GettingLabReady.ps1

Load the module on the AdminPC

Open PowerShell 7.1 or later as administrator. To use the version in this repository, run these commands from its root directory. The module manifest requires NtpTime 1.1 or later.

Install-Module -Name NtpTime -MinimumVersion 1.1 -Scope CurrentUser
Import-Module .\WindowsLab\WindowsLab.psd1
Get-Command -Module WindowsLab

To install the release published on PowerShell Gallery, use Install-Module -Name WindowsLab -Scope CurrentUser. WindowsLab on PowerShell Gallery

Create and select a lab

New-Lab -LabName 'Language Lab' -LabPcNames 'PC01','PC02','PC03'
Select-Lab -LabName 'Language Lab'
Show-LabPc
Test-LabPcPrompt

New-Lab selects the first lab automatically. Use Select-Lab to switch between labs. The AdminPC stores the inventory, MAC addresses and selection for the current Windows user in %APPDATA%\WindowsLab\new_config.json.

Available commands

Command What it does
New-Lab Creates a named lab with an ordered list of computer names.
Show-Lab Lists the labs and marks the selected one.
Select-Lab Selects a lab by name.
Show-LabPc Lists the selected lab's computers and saved MAC addresses.
Remove-Lab Removes a lab from the inventory. Select another lab first if the one to remove is active.
Test-LabPcPrompt Checks whether each LabPC answers a WinRM identification request.
Get-LabMac Saves the MAC address when it finds one active Ethernet adapter. Keeps the previous address if discovery fails or is ambiguous.
Start-LabPc Sends a Wake-on-LAN packet for each PC with a saved MAC address. Enable wired Wake-on-LAN on the LabPCs and run Get-LabMac while they are online.
Stop-LabPc Requests an immediate forced shutdown on each LabPC.
Restart-LabPc Requests an immediate forced restart on each LabPC.
Sync-LabPcDate Sets the AdminPC clock from NTP, then sends that time to the LabPCs.
Disconnect-User Logs off the user sessions found on each LabPC.
New-LabUser Creates a local standard account with a blank, non-expiring password.
Set-LabUser Changes a LabUser's password, account type (StandardUser or Administrator), or both.
Remove-LabUser Logs off the named user's sessions, removes the local account, then removes its Windows profile if present.

To preview an account change, use -WhatIf. When you run the change, the AdminPC prompts once for the new password.

Set-LabUser -UserName Student -SetPassword -AccountType StandardUser -WhatIf

Read the results

The AdminPC groups replies in the order shown by Show-LabPc. Each line gives the computer name, status and detail. When a command has multiple steps, such as changing a password and a role, each step can have its own result.

PC01 OK WinRM responded.
PC02 Failed Access denied. (0x80070005)
PC03 No response WinRM connection failed. (0x80338012)

No response means the AdminPC received no result from that LabPC. When Windows supplies a cause, the summary includes it and, when available, the diagnostic code. Shutdown requested., Restart requested. and Wake-on-LAN packet sent. describe the action that the command could confirm.

Usage note

I developed and actively use this module to manage computer labs at the school where I work as an IT assistant.

About

Tools to administer a Windows OS computer lab

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages