Added Release 1

This commit is contained in:
Bram Prieshof
2020-01-27 23:19:12 +01:00
parent aac9dce30a
commit fc8c8a261b
7 changed files with 220 additions and 0 deletions

59
V1_SysDesk-SaveSystem.ps1 Normal file
View 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