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 SSH - Keyboard Interactive Authentication
by  KevinA-REJIS   Go to last post Go to first unread
Last post: Today at 7:44:48 PM(UTC)
Lansweeper Are Deleted Dashboard Tabs Retrievable?
by  Esben.D  
Go to last post Go to first unread
Last post: Today at 4:58:48 PM(UTC)
Lansweeper Missing hyperv host details for guest asset LAN-4130
by  Esben.D   Go to last post Go to first unread
Last post: Today at 4:56:30 PM(UTC)
Lansweeper Dell Warranty Lookup - Incorrect Information
by  Esben.D  
Go to last post Go to first unread
Last post: Today at 4:46:38 PM(UTC)
Lansweeper Initial web loading time
by  Brian Fulmer   Go to last post Go to first unread
Last post: Today at 4:18:54 PM(UTC)
Lansweeper Force SNMP?
by  Andreas  
Go to last post Go to first unread
Last post: Today at 12:30:00 PM(UTC)
Lansweeper Network connections Overview Map
by  CoolDood   Go to last post Go to first unread
Last post: Today at 12:19:21 PM(UTC)
Lansweeper Scanning remote networks
by  Xavi  
Go to last post Go to first unread
Last post: Today at 11:30:16 AM(UTC)