mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-12-06 02:58:17 +01:00
Changes to doc and api/app for be able to record more things
This commit is contained in:
1 parent
9de38014be
commit
cbe562da96
9 files changed
+105
-140
No files matched your search
+32
-12
@@ -1,13 +1,13 @@
|
||||
# Build 9
|
||||
# Build 11
|
||||
param([Int32]$startup=0)
|
||||
Write-Host $startup
|
||||
$root = $PSCommandPath | Split-Path -Parent
|
||||
$server = (Get-Content "$root\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).server
|
||||
$resources = (Get-Content "$root\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).resources
|
||||
#Write-Host $startup
|
||||
$srcdir = $PSCommandPath | Split-Path -Parent
|
||||
$server = (Get-Content "$srcdir\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).server
|
||||
$resources = (Get-Content "$srcdir\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).resources
|
||||
$64bit = [Environment]::Is64BitOperatingSystem
|
||||
|
||||
$computerName = [System.Net.Dns]::GetHostName()
|
||||
$UUID=(get-wmiobject Win32_ComputerSystemProduct).UUID
|
||||
$UUID=(Get-CimInstance Win32_ComputerSystemProduct).UUID
|
||||
|
||||
$exists = Invoke-RestMethod -Method Get -Uri "$server/get/computerexists?ComputerName=$computerName&UUID=$UUID"
|
||||
if ($exists.Result -eq "ERROR"){
|
||||
@@ -29,15 +29,35 @@ if ($SOVersion -match "^10.0."){ #If its Windows 10, add revision number for kno
|
||||
}
|
||||
|
||||
# Update Computer Data
|
||||
$CPUInfo = Get-WmiObject Win32_Processor
|
||||
$RAMInstalled = Get-WmiObject CIM_PhysicalMemory | Measure-Object -Property capacity -Sum | ForEach-Object {[math]::round(($_.sum / 1MB),2)}
|
||||
$paramInvoke = -join("$server/upd/computer?ComputerName=$computerName&UUID=",$UUID,"&SOVersion=",$SOVersion,"&SOCaption=",$SOData.Caption,"&SOBit=",$SOData.OsArchitecture.Substring(0,2),"&LastConnection=",$Timestamp,"&RAM=",$RAMInstalled,"&CPUName=",$CPUInfo.Name)
|
||||
Invoke-RestMethod -Method Get -Uri $paramInvoke | out-null
|
||||
# More info
|
||||
$CPUInfo = (Get-CimInstance Win32_Processor) | Select Name,MaxClockSpeed,ThreadCount
|
||||
$CPUName = -join($CPUInfo.ThreadCount, " x ",$CPUInfo.Name.Trim()," (",$CPUInfo.MaxClockSpeed," MHz)")
|
||||
$RAMInstalled = Get-CimInstance CIM_PhysicalMemory | Measure-Object -Property capacity -Sum | ForEach-Object {[math]::round(($_.sum / 1MB),2)}
|
||||
$RAMFree = [Math]::Round((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory/1024,0)
|
||||
$RAMUsed = $RamInstalled-$RAMFree
|
||||
# Disks
|
||||
$objDisks = Get-CimInstance -Class win32_LogicalDisk -Filter "DriveType = '3'"
|
||||
$diskResults = @()
|
||||
ForEach( $disk in $objDisks )
|
||||
{
|
||||
$ThisVolume = "" | select Volume,Capacity,FreeSpace
|
||||
$ThisVolume.Volume = $disk.DeviceID
|
||||
$ThisVolume.Capacity = $([Math]::Round($disk.Size / 1GB,2))
|
||||
$ThisVolume.FreeSpace = $([Math]::Round($disk.FreeSpace / 1GB,2))
|
||||
$DiskResults += $ThisVolume
|
||||
}
|
||||
$DisksData = $DiskResults |ConvertTo-Json
|
||||
$DisksData = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($DisksData)) #I can't enter to database all without encode
|
||||
$lastUser = (Get-CimInstance -ClassName Win32_ComputerSystem -Property UserName -ComputerName .).UserName
|
||||
Invoke-RestMethod -Method Get -Uri "$server/upd/computer?ComputerName=$computerName&UUID=$UUID&LastUser=$lastUser" | out-null
|
||||
# Send it
|
||||
$paramInvoke = -join("$server/upd/computer?ComputerName=$computerName&UUID=",$UUID,"&SOVersion=",$SOVersion,"&SOCaption=",$SOData.Caption,"&SOBit=",$SOData.OsArchitecture.Substring(0,2),"&LastConnection=",$Timestamp,"&RAM=",$RAMInstalled,"&RAMFree=",$RAMFree,"&CPUName=",$CPUName,"&LastUser=",$lastUser,"&HDD=",$DisksData)
|
||||
Invoke-RestMethod -Method Get -Uri $paramInvoke | out-null
|
||||
|
||||
# More info (Only if has to be)
|
||||
# $paramInvoke = -join("$server/upd/computerhis?ComputerName=$computerName&UUID=",$UUID,"&RAMFree=",$RAMFree,"&RAMUsed=",$RAMUsed,"&Timestamp=",$Timestamp,"&DisksUse=",$disksUse)
|
||||
# Invoke-RestMethod -Method Get -Uri $paramInvoke | out-null
|
||||
|
||||
|
||||
# Load Cooks of computer
|
||||
$cooks = Invoke-RestMethod -Method Get -Uri "$server/get/cookpend?ComputerName=$computerName&UUID=$UUID"
|
||||
|
||||
foreach ($CookName in $cooks){
|
||||
|
||||
Reference in new issue
Block a user