A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Windows 10 » Windows 10 Help Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Script to change user name and machine name on Windows 10



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old July 25th 17, 02:55 AM posted to alt.comp.os.windows-10
lifewoutmilk
external usenet poster
 
Posts: 88
Default Script to change user name and machine name on Windows 10

Joe Scotch wrote on 7/20/2017 8:13 PM:
Do you know of a script to periodically change the Windows 10 username &
machine name?

Some badly behaved programs phone home with the username and machinename so
I just want to change them periodically since they're meaningless to me in
all ways (they're just xxx and yyy currently, for example).
What would be best is a script that changes both randomly upon reboot or
manually upon invocation.

The actual names don't matter, probably it would be just aaa, bbb, ccc,
ddd, eee, fff, ggg, hhh, iii, etc or perhaps a random lookup from a
dictionary file but it doesn't matter where the machine name and user names
come from since they serve no purpose in my single-user desktop anyway.

They're just a privacy hole waiting to be exploited.

Do you know of a script to periodically change the Windows 10 username &
machine name on demand?


Minimally tested PowerShell to set your current username to a random
name of 15 characters and to give the computer a random 15 character
name. The call to Rename-Computer will restart the computer afterwards.
Un-comment the last two lines if you want this script to actually do
anything. Must be run as an Administrative user (which is also the
account to be renamed). I ran the script on a VM and ended up with a
computer name of ict9gjhqianswd and a hostname of ahzpkl99tpk69.

If you save the script as something.ps1, to actually run it you'll need
to modify the execution policy to allow running unsigned scripts.

Use at your own risk.

#v+
function Get-CurrentUserAccount {
Get-WmiObject -ClassName Win32_UserAccount | Where-Object {$_.Name
-like $env:USERNAME}
}

function Get-RandomName {
$alpha = ("abcdefghijklmnopqrstuvwxyz0123456789" -split '' |
Where-Object {$_ -ne $null })
$newName = ""
for ($i = 0; $i -lt 15; $i++) {
$newName += Get-Random -InputObject $alpha
}
$newName
}

$NewComputerName = Get-RandomName

$userAccount = Get-CurrentUserAccount
$NewUserName = Get-RandomName

#$userAccount.Rename($NewUserName)
#Rename-Computer -NewName $NewComputerName -Restart

#v-

Ads
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 05:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.