Added Release 1
This commit is contained in:
3
V1_KickStart_SysDesk-SaveSystem.cmd
Normal file
3
V1_KickStart_SysDesk-SaveSystem.cmd
Normal file
@@ -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
|
||||||
59
V1_SysDesk-SaveSystem.ps1
Normal file
59
V1_SysDesk-SaveSystem.ps1
Normal file
@@ -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
|
||||||
3
V2_KickStart_SysDesk-SaveSystem.cmd
Normal file
3
V2_KickStart_SysDesk-SaveSystem.cmd
Normal file
@@ -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
|
||||||
55
V2_SysDesk-SaveSystem.ps1
Normal file
55
V2_SysDesk-SaveSystem.ps1
Normal file
@@ -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
|
||||||
3
V3_KickStart_SysDesk-SaveSystem.cmd
Normal file
3
V3_KickStart_SysDesk-SaveSystem.cmd
Normal file
@@ -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
|
||||||
64
V3_SysDesk-SaveSystem.ps1
Normal file
64
V3_SysDesk-SaveSystem.ps1
Normal file
@@ -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
|
||||||
33
productkey-V2.vbs
Normal file
33
productkey-V2.vbs
Normal file
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user