Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
- function Get-RandomString {
- param([int]$Length,
- [int]$upperCase,
- [int]$onlyNumber)
- if ($onlynumber -eq 1) {
- $set = "0123456789".ToCharArray()
- }
- else {
- $set = "abcdef0123456789".ToCharArray()
- }
- $result = ""
- for ($x = 0; $x -lt $Length; $x++) {
- $result += $set | Get-Random
- }
- if ($upperCase -eq 1) { return $result.ToUpper() }
- else { return $result }
- }
- function Set-HWProfileID {
- $registryPath = "Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\0001"
- $registryKeyName = "HwProfileGuid"
- $HwProfile = Get-ItemProperty -Path $registryPath -Name $registryKeyName
- $len = $HwProfile.HwProfileGuid.Length
- $Rand1 = Get-RandomString -Length 8 -upperCase 0 -onlyNumber 0
- $Rand2 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $Rand3 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $Rand4 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $Rand5 = Get-RandomString -Length 12 -upperCase 0 -onlyNumber 0
- $RandID = "{$Rand1-$Rand2-$Rand3-$Rand4-$Rand5}"
- Set-ItemProperty -Path $registryPath -Name $registryKeyName -Value $RandID
- }
- function Set-ProductID {
- $registryPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
- $registryKeyName = "ProductId"
- $HwProfile = Get-ItemProperty -Path $registryPath -Name $registryKeyName
- $len = $HwProfile.HwProfileGuid.Length
- $Rand1 = Get-RandomString -Length 5 -upperCase 0 -onlyNumber 1
- $Rand2 = Get-RandomString -Length 5 -upperCase 0 -onlyNumber 1
- $Rand3 = Get-RandomString -Length 5 -upperCase 0 -onlyNumber 1
- $Rand4 = Get-RandomString -Length 5 -upperCase 1 -onlyNumber 0
- $RandID = "$Rand1-$Rand2-$Rand3-$Rand4"
- $RandName = Get-RandomString -Length 10 -upperCase 1 -onlyNumber 0
- $InstallDate = [int][double]::Parse($(Get-Date -date (Get-Date).ToUniversalTime()-uformat %s))
- $InstallTimeRand = Get-RandomString -Length 16 -upperCase 0 -onlyNumber 1
- $InstallTime = "13$installTImeRand"
- Set-ItemProperty -Path $registryPath -Name $registryKeyName -Value $RandID
- Set-ItemProperty -Path $registryPath -Name "RegisteredOwner" -Value $RandName
- Set-ItemProperty -Path $registryPath -Name "InstallDate" -Value $InstallDate
- Set-ItemProperty -Path $registryPath -Name "InstallTime" -Value $InstallTime
- }
- function Set-VolID {
- $volidPath = "$scriptPath\Volumeid64.exe"
- $volID1 = Get-RandomString -Length 4 -upperCase 1 -onlyNumber 0
- $volID2 = Get-RandomString -Length 4 -upperCase 1 -onlyNumber 0
- $volidArgs = "C: $volID1-$volID2"
- $ps = New-Object System.Diagnostics.Process
- $ps.StartInfo.FileName = $volidPath
- $ps.StartInfo.Arguments = $volidArgs
- $ps.StartInfo.RedirectStandardOutput = $False
- $ps.StartInfo.UseShellExecute = $True
- $ps.StartInfo.WindowStyle = "Hidden"
- $ps.StartInfo.CreateNoWindow = $True
- $psReturnCOde = $ps.Start()
- if (-Not $ps.WaitForExit(10000)) { $ps.kill() }
- }
- function Set-DiskGPTID {
- $diskGPTPath = "diskpart"
- $diskGPTID1 = Get-RandomString -Length 8 -upperCase 0 -onlyNumber 0
- $diskGPTID2 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $diskGPTID3 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $diskGPTID4 = Get-RandomString -Length 4 -upperCase 0 -onlyNumber 0
- $diskGPTID5 = Get-RandomString -Length 12 -upperCase 0 -onlyNumber 0
- $diskGPTID = "$diskGPTID1-$diskGPTID2-$diskGPTID3-$diskGPTID4-$diskGPTID5"
- $diskpartScriptFile = New-Item "$scriptPath\diskpart.txt" -type file -force
- Add-Content "$scriptPath\diskpart.txt" "select disk 1"
- Add-Content "$scriptPath\diskpart.txt" "uniqueid disk id=$diskGPTID"
- sleep -Seconds 2
- $diskGPTArgs = "/s ""$scriptPath\diskpart.txt"""
- $ps = New-Object System.Diagnostics.Process
- $ps.StartInfo.FileName = $diskGPTPath
- $ps.StartInfo.Arguments = $diskGPTArgs
- $ps.StartInfo.RedirectStandardOutput = $False
- $ps.StartInfo.UseShellExecute = $True
- $ps.StartInfo.WindowStyle = "Hidden"
- $ps.StartInfo.CreateNoWindow = $True
- $psReturnCOde = $ps.Start()
- if (-Not $ps.WaitForExit(10000)) { $ps.kill() }
- }
- function Set-ComputerName {
- $computerNameRand1 = Get-RandomString -Length 6 -upperCase 1
- $computerNameRand = "DESKTOP-$computerNameRand1"
- Rename-Computer -ComputerName "localhost" -NewName $computerNameRand
- }
- $answer = Read-Host -Prompt "******** WARNING! Read careful! ******** `n `nRequirements `n 1. You are running W7 or later as 64-bit Version `n 2. Your Harddrive is formated as GPT and not MBR (check google what that means and how to check) `n `n Press [y] if you agree to continue or any other key to abort."
- if ($answer -eq "y") {
- try
- {
- Write-Host "Changing HWProfile GUID..."
- Set-HWProfileID
- Write-Host "Done"
- }
- catch
- {
- Write-Host "ERROR: Could not change HWProfile GUID (run Script as Administrator)"
- }
- try
- {
- Write-Host "Changing Windows Product ID..."
- Set-ProductID
- Write-Host "Done"
- }
- catch
- {
- Write-Host "ERROR: Could not change WIndows Product ID (run Script as Administrator)"
- }
- try
- {
- Write-Host "Changing VolumeID GUID..."
- Set-VolID
- Write-Host "Done"
- }
- catch
- {
- Write-Host "ERROR: Could not change Volume GUID (run Script as Administrator)"
- }
- try
- {
- Write-Host "Changing GPT GUID..."
- ###### Does not work yet
- #Set-DiskGPTID
- Write-Host "Done"
- }
- catch
- {
- Write-Host "ERROR: Could not change GPT GUID (run Script as Administrator)"
- }
- try
- {
- Write-Host "Changing PC Name..."
- Set-ComputerName
- Write-Host "Done"
- }
- catch
- {
- Write-Host "ERROR: Could not change PC Name (run Script as Administrator)"
- }
- $answer = Read-Host -Prompt "WARNING! The PC needs a restart for changes to take effect. `n `nALSO CHANGE YOUR MAC ADDRESS AND YOUR IP!`n `nPress [y] to accept or any other key to manual restart later."
- if ($answer -eq "y") {
- Restart-Computer -Force
- }
- }
- else {
- Write-Host "Aborted"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement