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: 368  
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: 72  
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

Action Open Teams/SfB Chat with user
by  dshu   Go to last post Go to first unread
Last post: 6/25/2020 7:04:55 PM(UTC)
Action Find lost space the easy way (spacesniffer.exe)
by  krozar  
Go to last post Go to first unread
Last post: 5/5/2020 10:27:33 PM(UTC)
Lansweeper Querying a web server or web services
by  mmo   Go to last post Go to first unread
Last post: 5/5/2020 9:00:36 PM(UTC)
Action Password Status
by  brodiemac-too  
Go to last post Go to first unread
Last post: 4/23/2020 9:01:03 PM(UTC)
Action Email user
by  Michael Kop   Go to last post Go to first unread
Last post: 4/7/2020 11:24:12 AM(UTC)
Lansweeper actualizacion de datos importando csv
by  jhon freddy  
Go to last post Go to first unread
Last post: 3/31/2020 9:04:45 PM(UTC)
Lansweeper Asset Actions - RunAs Prompt
by  Socal_s197   Go to last post Go to first unread
Last post: 3/26/2020 10:02:16 PM(UTC)
Lansweeper Remote Registry 2019
by  CyberCitizen  
Go to last post Go to first unread
Last post: 3/6/2020 12:25:39 AM(UTC)