Using module .\Software\SoftwareCollector.psm1
Using module .\Hardware\HardwareCollector.psm1
Using module .\Helper\LogException.psm1
Using module .\Helper\Setup.psm1
Using module .\Helper\OutputFormatter.psm1
Using module ..\..\Helper\OutputFormatter.psm1
Using module ..\..\Helper\OutputFormatter.psm1
Using module ..\..\Helper\OutputFormatter.psm1
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: c0439dc0-01c8-4f9a-aa3e-a43f1f38e416
# Source File: C:\DEV\SISA.Inventar\SISA.Inventar\SISA.Inventar.psproj
#------------------------------------------------------------------------
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.154
Generated on: 30.08.2018 10:06
Generated by: pt
--------------------------------------------------------------------------------
.DESCRIPTION
Script generated by PowerShell Studio 2018
#>
#region Source: Startup.pss
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
#endregion Import Assemblies
function Main {
#Check the Environment
Try
{
$setupResult = Setup
If (!$setupResult)
{
Write-Error -Message ("The Root Folder" + $global:rootDir + "does not exist or is not accessible!") -Category ObjectNotFound
Exit
}
}
Catch
{
LogException $global:logfilename $_
Exit
}
#Read the Software
Try
{
CollectSoftware
ExportSoftwareList
WriteErrorLog
}
Catch
{
LogException $global:Slogfilename $_
}
#Read the Hardware
Try
{
CollectHardware
ExportHardwareList
WriteErrorLog
}
Catch
{
LogException $global:Hlogfilename $_
}
$script:ExitCode = 0
}
#endregion Source: Startup.pss
#region Source: Hardware\SpecificCollector\FirewallCollector.psm1
function
{
Function CollectFirewall
{
$prefix = "FireWall"
$domainprofile = netsh advfirewall show domainprofile state
$domainprofile = $domainprofile.GetValue(3).Remove(0, 5).Trim()
AddHardWare -code ($prefix + "DomainProfile") -value $domainprofile
$privateprofile = netsh advfirewall show privateprofile state
$privateprofile = $privateprofile.GetValue(3).Remove(0, 5).Trim()
AddHardWare -code ($prefix + "PrivateProfile") -value $privateprofile
$publicprofile = netsh advfirewall show publicprofile state
$publicprofile = $publicprofile.GetValue(3).Remove(0, 5).Trim()
AddHardWare -code ($prefix + "PublicProfile") -value $publicprofile
}
Export-ModuleMember CollectFirewall
}
#endregion Source: FirewallCollector.psm1
#region Source: Hardware\SpecificCollector\MachineCollector.psm1
function
{
$prefix = "Machine"
function CollectMachine
{
$win32ComputerSystem = Get-CimInstance -ClassName Win32_ComputerSystem
AddHardWare -code ($prefix + "Manufacturer") -value $win32ComputerSystem.Manufacturer
AddHardWare -code ($prefix + "Model") -value $win32ComputerSystem.Model
AddHardWare -code ($prefix + "Family") -value $win32ComputerSystem.SystemFamily
AddHardWare -code ($prefix + "Status") -value $win32ComputerSystem.Status
AddHardWare -code ($prefix + "DNSHostName") -value $win32ComputerSystem.DNSHostName
AddHardWare -code ($prefix + "Domain") -value $win32ComputerSystem.Domain
AddHardWare -code ($prefix + "Type") -value $win32ComputerSystem.SystemType
AddHardWare -code ($prefix + "User") -value $win32ComputerSystem.UserName
$cimBiosElement = Get-CimInstance -ClassName CIM_BIOSElement
AddHardWare -code ($prefix + "BiosVersion") -value $cimBiosElement.Caption
AddHardWare -code ($prefix + "BiosSerial") -value $cimBiosElement.SerialNumber
$cimDiskDrive = Get-CimInstance -ClassName CIM_DiskDrive
$x = 0
ForEach ($drive In $cimDiskDrive)
{
AddHardWare -code ($prefix + "DiskModel_" + $x) -value $drive.Model
AddHardWare -code ($prefix + "DiskSerial_" + $x) -value $drive.SerialNumber
AddHardWare -code ($prefix + "DiskInterface_" + $x) -value $drive.InterfaceType
AddHardWare -code ($prefix + "DiskSize_" + $x) -value $drive.Size
$x += 1
}
AddHardWare -code ($prefix + "DiskCount") -value $x
$win32VideoController = Get-CimInstance -ClassName Win32_VideoController
$x = 0
ForEach ($contoller In $win32VideoController)
{
AddHardWare -code ($prefix + "VideoController_" + $x) -value $contoller.Caption
AddHardWare -code ($prefix + "VideoControllerCurrentVerticalResolution_" + $x) -value $contoller.CurrentVerticalResolution
AddHardWare -code ($prefix + "VideoControllerCurrentHorizontalResolution_" + $x) -value $contoller.CurrentHorizontalResolution
AddHardWare -code ($prefix + "VideoControllerStatus_" + $x) -value $contoller.Status
$x += 1
}
AddHardWare -code ($prefix + "VideoControllerCount") -value $x
$win32PhysicalMemory = Get-CimInstance -ClassName Win32_PhysicalMemory
$x = 0
ForEach ($memry In $win32PhysicalMemory)
{
AddHardWare -code ($prefix + "MemoryBankLabel_" + $x) -value $memry.BankLabel
AddHardWare -code ($prefix + "MemoryCaption_" + $x) -value $memry.Caption
AddHardWare -code ($prefix + "MemoryManufacturer_" + $x) -value $memry.Manufacturer
AddHardWare -code ($prefix + "MemoryFormFactor_" + $x) -value $memry.FormFactor
AddHardWare -code ($prefix + "MemoryPartNumber_" + $x) -value $memry.PartNumber
AddHardWare -code ($prefix + "MemorySerialNumber_" + $x) -value $memry.SerialNumber
AddHardWare -code ($prefix + "MemoryCapacity_" + $x) -value $memry.Capacity
$x += 1
}
AddHardWare -code ($prefix + "MemoryCount") -value $x
}
Export-ModuleMember CollectMachine
}
#endregion Source: MachineCollector.psm1
#region Source: Hardware\SpecificCollector\OSCollector.psm1
function
{
$prefix = "OS"
function CollectOS
{
$cimsoftwareLicensingService = Get-CimInstance -ClassName SoftwareLicensingService
AddHardWare -code ($prefix + "LicenseKey") -value $cimsoftwareLicensingService.OA3xOriginalProductKey
$cimOS = Get-CimInstance -ClassName Win32_OperatingSystem
AddHardWare -code ($prefix + "Status") -value $cimOS.Status
AddHardWare -code ($prefix + "Caption") -value $cimOS.Caption
AddHardWare -code ($prefix + "CodeSet") -value $cimOS.CodeSet
AddHardWare -code ($prefix + "CountryCode") -value $cimOS.CountryCode
AddHardWare -code ($prefix + "Locale") -value $cimOS.Locale
AddHardWare -code ($prefix + "MUILanguages") -value $cimOS.MUILanguages
AddHardWare -code ($prefix + "OSArchitecture") -value $cimOS.OSArchitecture
AddHardWare -code ($prefix + "SerialNumber") -value $cimOS.SerialNumber
AddHardWare -code ($prefix + "Version") -value $cimOS.Version
AddHardWare -code ($prefix + "InstallDate") -value $cimOS.InstallDate
}
Export-ModuleMember CollectOS
}
#endregion Source: OSCollector.psm1
#region Source: Globals.ps1
function Invoke-Globals_ps1
{
$global:errorarray = @()
$global:Harray = @()
$global:Sarray = @()
$global:rootDir = "\\Sisanas06\all_sisa\Inventar\"
$global:SrootDir = "\\Sisanas06\all_sisa\Inventar\Software"
$global:HrootDir = "\\Sisanas06\all_sisa\Inventar\Hardware"
$global:LrootDir = "\\Sisanas06\all_sisa\Inventar\Log"
#general Log File
$global:logfilename = Join-Path -Path $global:LrootDir -ChildPath "${env:COMPUTERNAME}_$(get-date -f yyyyMMdd).log"
#Hardware Data and Log File
$global:Hfilename = Join-Path -Path $global:HrootDir -ChildPath "${env:COMPUTERNAME}_$(get-date -f yyyyMMdd).hwi"
$global:Hlogfilename = Join-Path -Path $global:LrootDir -ChildPath "${env:COMPUTERNAME}_$(get-date -f yyyyMMdd).hwi.log"
#Software Data and Log File
$global:Sfilename = Join-Path -Path $global:SrootDir -ChildPath "${env:COMPUTERNAME}_$(get-date -f yyyyMMdd).swi"
$global:Slogfilename = Join-Path -Path $global:LrootDir -ChildPath "${env:COMPUTERNAME}_$(get-date -f yyyyMMdd).swi.log"
}
#endregion Source: Globals.ps1
#Start the application
Main ($CommandLine)