Hi,
Am very new to SimpleHelp and trying to make a power shell script to rename a pc and ask the technician for the new name.
# Prompt technician for new computer name (text input)
$renamemachine = ServerUtilsAskTech(Enter new computer name:, text)
# Check if input is empty or null
if ([string]::IsNullOrWhiteSpace($renamemachine)) {
Write-Output "No name entered. Aborting."
exit
}
# Rename the computer
Rename-Computer -NewName "$renamemachine" -Force
Keep getting no name entered. Aborting… then, testbord11 is not recognized as the name of a cmdlet, function, script file etc…
How about that! It worked!! Thank You
Here’s the finished code.
# Prompt technician for new computer name (text input)
$renamemachine = "ServerUtilsAskTech(Enter new computer name:, text)"
# Check if input is empty or null
if ([string]::IsNullOrWhiteSpace($renamemachine)) {
Write-Output "No name entered. Aborting."
exit
}
# Rename the computer
Rename-Computer -NewName $renamemachine -Force
Run as powershell script
Set Wait for the tool to complete before returning
Choose Run as the service user