Upload files to "/"
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# ChangeComputerName.ps1
|
||||
# Wymaga uruchomienia z uprawnieniami Administratora
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
# Pobieranie danych od użytkownika
|
||||
$compNumber = Read-Host "Numer komputera"
|
||||
$roomNumber = Read-Host "Sala"
|
||||
|
||||
# Budowanie nowej nazwy komputera
|
||||
$newName = "TE-LOD-D-${compNumber}s${roomNumber}"
|
||||
|
||||
Write-Host "" # Pusta linia dla lepszej czytelności
|
||||
|
||||
try {
|
||||
# Zmiana nazwy komputera
|
||||
Rename-Computer -NewName $newName -ErrorAction Stop
|
||||
|
||||
# Wyświetlanie komunikatów o sukcesie
|
||||
Write-Host "[Info] Ustawiono nazwę komputera na $newName" -ForegroundColor Green
|
||||
Write-Host "[Info] Automatyczny restart nastąpi za chwile..." -ForegroundColor Yellow
|
||||
|
||||
# Czekamy 4 sekundy, żeby użytkownik przeczytał komunikat
|
||||
Start-Sleep -Seconds 4
|
||||
|
||||
# Wymuszenie restartu
|
||||
Restart-Computer -Force
|
||||
} catch {
|
||||
Write-Host "[Błąd] Nie udało się zmienić nazwy. Szczegóły: $_" -ForegroundColor Red
|
||||
}
|
||||
Reference in New Issue
Block a user