As a new customer with LANDesk one of the common requests my IT staff asked for is to have the ability to rename managed computers remotely. This option is not native inside the LANDesk console. So one of the things I was able to do is modify the context-menu within LANDesk and added that functionality.
This process will take a few minor steps and requires the system using LANDesk Remote Console to have Microsoft's Remote Server Administration Tools (RSAT) installed and turned on. This is because we will leverage the NETDOM utility that comes with RSAT to perform this duty.
Step 1 -
- Install the Remote Server Administration Tools (RSAT) based on the version of Windows' Network Operating System (NOS) you're currently running LANDesk's Remote Console on. ( http://lmgtfy.com/?q=remote+server+administration+tools )
- Go to Control Panel > Programs and Features > Turn Windows features on or off. (start \ run \ appwiz.cpl)
- In the treeview, select Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools > AD DS Tools and click OK.
NETDOM should now be located inside your System32 folder and part of your system's Environment Variables.
Step 2 -
You will need to create your own or use my (attached) registry file and script that calls the NETDOM utility using command line arguments.
- Create your script in order to call NETDOM within LANDesk.
- I selected VBScript but you might want to consider AutoIT to mask passwords or PowerShell to use single sign-on via Microsoft Kerberos.
' NAME: LDRC.vbs
' DATE : 05/09/2016
' COMMENT: Add the option to rename computers from the LANDesk console.
' error handling
On Error Resume Next
' loading action
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
StrComputerOldName = WScript.Arguments.item(0)
'StrComputerOldName = Inputbox("Enter Remote Computer Name.")
StrComputerNewName = Inputbox("Enter New Computer Name.")
StrUsername = Inputbox("Enter Username")
StrPassword = Inputbox("Enter Password")
' Run Application
wshshell.run "cmd /c netdom renamecomputer " & StrComputerOldName & " /newname:" & StrComputerNewName & " /userd:" & StrUsername & " /passwordd:" & StrPassword & " /Force /Reboot:10", 0, True
- The above script is a basic example of what you can use. You can put that VBscript in a share folder on the LDMS server or in some other location with read access for your IT staff. You can also uncomment the StrComputerOldName to allow it to ask for the remote computer's hostname. However, we're trying to make LANDesk pass that information so it is recommended you allow the WScript.Arguments.item(0) set the variable via LANDesk console.
- Next you need to import the Rename Computer into the LANDesk's Context Menu. Use the following Reg import after you modify the server, share folder, and script names based on your own flavor.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Managed Planet\Console Extender\Plugins\Rename Computer]
- The <Computer.Device Name> entry is what LANDesk would use to pass the computer's hostname from LANDesk into the CLI Argument of your custom NETDOM script. In my example that would be the wscript.arguments.item(0).
Step 3 -
Now that you have RSAT installed, your custom script created and shared, and the registry file import; you can now right-click any active computer inside of LANDesk Remote Console and have the option to Rename Computer.
Please be aware that using VBScript 'as-is' will display the password in clear text. That's why I'd recommend tweaking it so you cannot see it. You can also modify your script to be all one form, add titles to windows, and other fun stuff. This is just a quick and dirty example. I also hard coded a ten (10) second warning before the reboot during the rename process. You can modify that in your script or add that to another input box to allow your IT staff to pick how many seconds the warning will appear prior to rebooting.
I have added these examples as an attachment for you as well. Please let me know if you found a better way to do the same task or have any questions or concerns.
Special thanks to Tom F. from LANDesk for the guidance and help during our initial deployment.
LDRCTEMP.zip 924 bytes