Added Release 1
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user