Added Rename Computer Community Script

This commit is contained in:
silversword411 2021-03-16 17:10:23 -04:00
parent d6d0f8fa17
commit c32bb35f1c
2 changed files with 21 additions and 0 deletions

View File

@ -236,5 +236,12 @@
"name": "Event Viewer - Check for Bluescreens",
"description": "This will check for Bluescreen events on your system",
"shell": "powershell"
},
{
"filename": "Rename_Computer.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Rename Computer",
"description": "Rename computer. First parameter will be new PC name. 2nd parameter if yes will auto-reboot machine",
"shell": "powershell"
}
]

View File

@ -0,0 +1,14 @@
# Chanage the computer name in Windows
# v1.0
# First Command Parameter will be new computer name
# Second Command Parameter if yes will auto-restart computer
$param1=$args[0]
$ToRestartTypeYes=$args[1]
Rename-Computer -newname "$param1"
# Restart the computer for rename to take effect
if ($ToRestartTypeYes -eq 'yes') {
Restart-Computer -Force
}