‎02-01-2022 08:19 AM - last edited on ‎04-01-2024 04:10 PM by Mercedes_O
Hello, I am looking for action which would help me rename computers in network. The perfect solution would be rename computer by Custom field(we have "Inventory number"), so we can identify these computers easier and have everything organized. I think this can't be done automatically, so at least pop up should open with input area, and I can submit new computer name.
Thank you in advance,
Dovydas
‎03-04-2022 03:44 AM
{actionpath}Change_Computer_Name.vbs {computer}
strCurrentPCName = WScript.Arguments(0)
If strCurrentPCName = "" Then
Wscript.Quit
End If
strNewName = Inputbox("New Computer Name:","Enter the new name for this computer","")
If IsEmpty(strNewName) or IsNull(strNewName) Then
Wscript.Quit
Else
Dim cmd,shell,executor,ps1result,strResult
cmd = "powershell.exe -ExecutionPolicy Bypass -noprofile -command \\YOUR-SERVER-NAME-HERE\lansweeper$\Change_Computer_Name.ps1 '" & strCurrentPCName & "' '" & strNewName & "'"
Set shell = CreateObject("WScript.Shell")
Set executor = shell.Exec(cmd)
executor.StdIn.Close
ps1result = executor.StdOut.ReadAll
strResult = Trim(ps1result)
If IsEmpty(strResult) or IsNull(strResult) Then
Else
Msgbox "Update requested. The changes will take effect after you restart the computer."
End If
End If
$strCurrentPCName = $args[0]
$strNewPCName = $args[1]
$Credentials = Get-Credential -Message "Enter your Windows admin credentials"
Rename-Computer -ComputerName $strCurrentPCName -NewName $strNewPCName -DomainCredential $Credentials -Force
‎02-16-2022 09:07 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now