diff --git a/V1_KickStart_SysDesk-SaveSystem.cmd b/V1_KickStart_SysDesk-SaveSystem.cmd new file mode 100644 index 0000000..3f198b1 --- /dev/null +++ b/V1_KickStart_SysDesk-SaveSystem.cmd @@ -0,0 +1,3 @@ +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy bypass -Scope CurrentUser +Powershell.exe ./V1_SysDesk-SaveSystem.ps1 +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser diff --git a/V1_SysDesk-SaveSystem.ps1 b/V1_SysDesk-SaveSystem.ps1 new file mode 100644 index 0000000..f5b45bf --- /dev/null +++ b/V1_SysDesk-SaveSystem.ps1 @@ -0,0 +1,59 @@ +#Vars +$sysType = "DT" +$Location = "SysLocation" +$NetAdap = "real" #can be broad(Full: broadcom), real(full: realtek) or vbox(full: VirtualBox) +$csvname = "datafile.csv" + +#Setup +$SYSID = Read-Host -Prompt 'Input System ID' +$SYSIDU = "$SYSID".ToUpper() +$file = "$SYSIDU.txt" + +#Checking if file exist +$filetest = Test-Path $SYSIDU* +if ($filetest -eq $True) { +Write-Host "This SysID already exists" +pause +exit +} + +#makeDir with SYSID +mkdir $SYSIDU +cd $SYSIDU + +#Getting WindowsKEY +$WinKey = cscript ../productkey-V2.vbs //Nologo + +#Getting System Serial +$serial = wmic bios get serialnumber +$shortserial = $serial -replace "SerialNumber" -replace '(?m)^\s*?\n' +$noBlanksSer = $shortserial -notmatch '^\n*$' +$noBlanks2ser = $noBlanksSer -notmatch '^\s*$' + +#Getting Macaddres +$macaddr = Get-CimInstance win32_networkadapterconfiguration |select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match $NetAdap } | select macaddress +$shortmacaddr = $macaddr -replace "macaddress" -replace '@{=' -replace '}' -replace ":","-" + +#Saveing SYSID to File +echo $SYSIDU >> $file + +#Saving sysType to File +echo $sysType >> $file + +#Saveing Serial to File +echo $noBlanks2ser >> $file + +#Saving Location +echo $Location >> $file + +#Saving Macaddres + + echo $shortmacaddr >> $file + +#Saving windows-key +echo $WinKey >> $file + +cd .. + +#Saving to Main CSV +echo "$SYSIDU,$sysType,$noBlanks2ser,$Location,$shortmacaddr,$WinKey" >> $csvname diff --git a/V2_KickStart_SysDesk-SaveSystem.cmd b/V2_KickStart_SysDesk-SaveSystem.cmd new file mode 100644 index 0000000..537a729 --- /dev/null +++ b/V2_KickStart_SysDesk-SaveSystem.cmd @@ -0,0 +1,3 @@ +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy bypass -Scope CurrentUser +Powershell.exe ./V3_SysDesk-SaveSystem.ps1 +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser diff --git a/V2_SysDesk-SaveSystem.ps1 b/V2_SysDesk-SaveSystem.ps1 new file mode 100644 index 0000000..903b1ac --- /dev/null +++ b/V2_SysDesk-SaveSystem.ps1 @@ -0,0 +1,55 @@ +#Vars +$sysType = "DT" +$Location = "SysLocation" +$NetAdap = "real" #can be broad(Full: broadcom), real(full: realtek) or vbox(full: VirtualBox) +$csvname = "datafile.csv" + + +#Setup +$SYSID = Read-Host -Prompt 'Input System ID' +$SYSIDU = "$SYSID".ToUpper() +$file = "$SYSIDU.txt" + +#Checking if file exist +$filetest = Test-Path $SYSIDU* + +if ($filetest -eq $True) { Write-Host +"This SysID already exists" + pause + exit + } + +#Getting WindowsKEY +$WinKey = cscript productkey-V2.vbs //Nologo + +#Getting System Serial +$serial = wmic bios get serialnumber +$shortserial = $serial -replace "SerialNumber" -replace '(?m)^\s*?\n' +$noBlanksSer = $shortserial -notmatch '^\n*$' +$noBlanks2ser = $noBlanksSer -notmatch '^\s*$' + +#Getting Macaddres +$macaddr = Get-CimInstance win32_networkadapterconfiguration |select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match $NetAdap } | select macaddress +$shortmacaddr = $macaddr -replace "macaddress" -replace '@{=' -replace '}' -replace ":","-" + +#Saveing SYSID to File +echo $SYSIDU >> $file + +#Saving sysType to File +echo $sysType >> $file + +#Saveing Serial to File +echo $noBlanks2ser >> $file + +#Saving Location +echo $Location >> $file + +#Saving Macaddres + + echo $shortmacaddr >> $file + +#Saving windows-key +echo $WinKey >> $file + +#Saving to Main CSV +echo "$SYSIDU,$sysType,$noBlanks2ser,$Location,$shortmacaddr,$WinKey" >> $csvname diff --git a/V3_KickStart_SysDesk-SaveSystem.cmd b/V3_KickStart_SysDesk-SaveSystem.cmd new file mode 100644 index 0000000..777a831 --- /dev/null +++ b/V3_KickStart_SysDesk-SaveSystem.cmd @@ -0,0 +1,3 @@ +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy bypass -Scope CurrentUser +Powershell.exe ./V2_SysDesk-SaveSystem.ps1 +Powershell.exe Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser diff --git a/V3_SysDesk-SaveSystem.ps1 b/V3_SysDesk-SaveSystem.ps1 new file mode 100644 index 0000000..51076ef --- /dev/null +++ b/V3_SysDesk-SaveSystem.ps1 @@ -0,0 +1,64 @@ +#Vars +$sysType = "DT" +$Location = "SysLocation" +$NetAdap = "real" #can be broad(Full: broadcom), real(full: realtek) or vbox(full: VirtualBox) +$dataFolder = "foldername" +$csvname = "datafile.csv" + + +#Setup +$SYSID = Read-Host -Prompt 'Input System ID' +$SYSIDU = "$SYSID".ToUpper() +$file = "$dataFolder/$SYSIDU.txt" + +#Checking if dataFolder exist +$dirtest = Test-Path $dataFolder + +if ($dirtest -eq $False) { Write-Host +mkdir $dataFolder + } + + +#Checking if file exist +$filetest = Test-Path $file + +if ($filetest -eq $True) { Write-Host +"This SysID already exists" + pause + exit + } + +#Getting WindowsKEY +$WinKey = cscript productkey-V2.vbs //Nologo + +#Getting System Serial +$serial = wmic bios get serialnumber +$shortserial = $serial -replace "SerialNumber" -replace '(?m)^\s*?\n' +$noBlanksSer = $shortserial -notmatch '^\n*$' +$noBlanks2ser = $noBlanksSer -notmatch '^\s*$' + +#Getting Macaddres +$macaddr = Get-CimInstance win32_networkadapterconfiguration |select description, macaddress | where {$_.MACAddress -ne $null } | where {$_.Description -match $NetAdap } | select macaddress +$shortmacaddr = $macaddr -replace "macaddress" -replace '@{=' -replace '}' -replace ":","-" + +#Saveing SYSID to File +echo $SYSIDU >> $file + +#Saving sysType to File +echo $sysType >> $file + +#Saveing Serial to File +echo $noBlanks2ser >> $file + +#Saving Location +echo $Location >> $file + +#Saving Macaddres + + echo $shortmacaddr >> $file + +#Saving windows-key +echo $WinKey >> $file + +#Saving to Main CSV +echo "$SYSIDU,$sysType,$noBlanks2ser,$Location,$shortmacaddr,$WinKey" >> $dataFolder/$csvname diff --git a/productkey-V2.vbs b/productkey-V2.vbs new file mode 100644 index 0000000..30a6c59 --- /dev/null +++ b/productkey-V2.vbs @@ -0,0 +1,33 @@ +Set WshShell = WScript.CreateObject("WScript.Shell") + +KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId" + +WScript.Echo ExtractKey(WshShell.RegRead(KeyPath)) + +Function ExtractKey(KeyInput) + Const KeyOffset = 52 + i = 28 + CharWhitelist = "BCDFGHJKMPQRTVWXY2346789" + Do + Cur = 0 + x = 14 + Do + Cur = Cur * 256 + Cur = KeyInput(x + KeyOffset) + Cur + KeyInput(x + KeyOffset) = (Cur \ 24) And 255 + Cur = Cur Mod 24 + x = x -1 + Loop While x >= 0 + i = i -1 + KeyOutput = Mid(CharWhitelist, Cur + 1, 1) & KeyOutput + If (((29 - i) Mod 6) = 0) And (i <> -1) Then + i = i -1 + KeyOutput = "-" & KeyOutput + End If + Loop While i >= 0 + ExtractKey = KeyOutput + +End Function + + +