V rámci distanční výuky jsou notebooky půjčovány žákům. Po vrácení NB je potřeba provést novou čistou instalaci - uvést NB do definovaného stavu
poznamka k PowerShellu $mac.gettype() PS C:\Windows\system32> $mac.gettype() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Object[] System.Array PS C:\Windows\system32> $mac.count 1
$mac = @(Get-CimInstance win32_networkadapterconfiguration | select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match "PCIe" })
$mac[0].macaddress -replace ":"
V naplanovaných úlohách je nastavena akce „Po spuštění“ - skript - C:\Users\zak\startup.cmd
if not exist C:\Users\zak\renameOK.txt ( PowerShell -Command "Set-ExecutionPolicy Unrestricted -Force" PowerShell C:\Users\zak\rename.ps1 PowerShell -Command "Set-ExecutionPolicy Restricted" dir > C:\Users\zak\renameOK.txt )
# NB Fujitsu $arrmac = @(Get-CimInstance win32_networkadapterconfiguration | select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match "PCIe" }) # NB Acer # $arrmac = @(Get-CimInstance win32_networkadapterconfiguration | select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match "Ethernet" }) $mac = $arrmac[0].macaddress -replace ":" $computername = "NB-" + $mac Rename-Computer -NewName $computername