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 Report showing single asset type
by  Liamsy11   Go to last post Go to first unread
Last post: Today at 2:43:05 PM(UTC)
Report Center All switches and the assets connected to them
by  CoolDood  
Go to last post Go to first unread
Last post: Today at 12:15:53 PM(UTC)
Report Center .Net 4.5 through 4.8 report - Reg Key scanning based
by  Martin Schulz   Go to last post Go to first unread
Last post: Today at 11:55:24 AM(UTC)
Lansweeper Assets and Owner listing help
by  ssmarr5  
Go to last post Go to first unread
Last post: Yesterday at 9:23:09 PM(UTC)
Lansweeper HPE SAS Solid State Drives failure report
by  Tommy75   Go to last post Go to first unread
Last post: Yesterday at 8:04:05 AM(UTC)
Lansweeper Software Missing Report
by  RC62N  
Go to last post Go to first unread
Last post: 12/6/2019 6:09:28 PM(UTC)
Lansweeper Assets without Asset Location
by  JLangthaler   Go to last post Go to first unread
Last post: 12/5/2019 12:44:19 PM(UTC)
Lansweeper Installed Memory report
by  lansend  
Go to last post Go to first unread
Last post: 12/2/2019 8:15:53 PM(UTC)