Notification

Icon
Error

Change Windows domain PC Name - Action+Powershell with Prompt

Posted: Monday, August 19, 2019 11:00:17 PM(UTC)
DaveDischord

DaveDischord

Member Original PosterPosts: 3
1
Like
New Action for PCs

Action line:
powershell.exe "{actionpath}ChangePCName.ps1" {smartname}

ChangePCName.ps1: (Make sure Encoding is right, like UCS2_LE or something, and of course, save in your action path)

param([String]$oldname)
$newname=Read-Host -Prompt "Input new Name and click [Enter]"

Rename-computer –computername $oldname –newname "$newname" –domaincredential [domainname]\administrator -force -restart


It'll come up with a shell asking for the new name you want it to be, then ask for your administrator password, or whatever user has rights to change the PC name, then that PC will restart.

CyberCitizen
#1CyberCitizen Member Posts: 266  
posted: 8/27/2019 6:50:25 AM(UTC)
Word of warning don't do on machines connected via Wifi if using a WiFi certificate as it will need to download an updated cert with new name etc.
max204
#2max204 Member Posts: 8  
posted: 9/19/2019 10:28:29 AM(UTC)
Great, thank you!

There's one thing you must change on your local computer that you're running Lansweeper from and that is to open PowerShell as an administrator and run this command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Otherwise it won't run the action from the web browser on your PC.
crashff
#3crashff Member Posts: 70  
posted: 11/27/2019 8:36:50 PM(UTC)
Originally Posted by: max204 Go to Quoted Post
Great, thank you!

There's one thing you must change on your local computer that you're running Lansweeper from and that is to open PowerShell as an administrator and run this command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Otherwise it won't run the action from the web browser on your PC.


Does this run on the machine hosting Lansweeper, or where I am accessing the website from? Local Computer and "location where Lansweeper is running" are not always the same.
DaveDischord
#4DaveDischord Member Original PosterPosts: 3  
posted: 11/27/2019 10:36:02 PM(UTC)
Originally Posted by: max204 Go to Quoted Post

Does this run on the machine hosting Lansweeper, or where I am accessing the website from? Local Computer and "location where Lansweeper is running" are not always the same.


That's a good question. I'm running everything on localhost, so I'm not too sure where the commands are initiated from. I'm going to go with a logical guess and say its from the server hosting LanSweeper, since its back-end functionality. Please correct me if I'm wrong. I'm curious myself.

Active Discussions

Lansweeper iManage Client deployment
by  CyberCitizen   Go to last post Go to first unread
Last post: Today at 3:09:47 AM(UTC)
Lansweeper Missing hyperv host details for guest asset LAN-4130
by  danielm  
Go to last post Go to first unread
Last post: 12/7/2019 7:15:56 AM(UTC)
Lansweeper Lansweeper showing MAC address instead of name
by  crashff   Go to last post Go to first unread
Last post: 12/6/2019 10:26:25 PM(UTC)
Lansweeper Dell Warranty Lookup - Incorrect Information
by  Trenton Knew  
Go to last post Go to first unread
Last post: 12/6/2019 10:17:15 PM(UTC)
Lansweeper Incoming Email Parse
by  UEFT   Go to last post Go to first unread
Last post: 12/6/2019 5:46:22 PM(UTC)
Lansweeper SSH - Keyboard Interactive Authentication
by  KevinA-REJIS  
Go to last post Go to first unread
Last post: 12/6/2019 5:22:21 PM(UTC)
Lansweeper Custom OID Scanning / multible OIDs with wildcards
by  Esben.D  
Go to last post Go to first unread
Last post: 12/6/2019 11:57:18 AM(UTC)