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: 2
0
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: 220  
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.

Active Discussions

Lansweeper Select individual assets from reports?
by  pryan67   Go to last post Go to first unread
Last post: Today at 10:39:16 PM(UTC)
Lansweeper Exchange Mailbox Usage
by  nhouse24  
Go to last post Go to first unread
Last post: Today at 10:31:09 PM(UTC)
Lansweeper Personalize interface user ticket
by  Brighton   Go to last post Go to first unread
Last post: Today at 9:31:34 PM(UTC)
Lansweeper Update dashboard defaulting to Helpdesk
by  nriddick  
Go to last post Go to first unread
Last post: Today at 9:22:18 PM(UTC)
Lansweeper Change Management : Creating new Events type
by  Hugo Lynch   Go to last post Go to first unread
Last post: Today at 8:05:34 PM(UTC)
Lansweeper Linked Tickets - Helpdesk Workflow/Subordinate Tickets
by  Argon0  
Go to last post Go to first unread
Last post: Today at 5:22:27 PM(UTC)
Lansweeper SCCM Scanning Failure
by  wanduster   Go to last post Go to first unread
Last post: Today at 4:18:47 PM(UTC)
Lansweeper Notification ticket in pending after 1 week
by  Vasile Ciuban  
Go to last post Go to first unread
Last post: Today at 3:18:04 PM(UTC)