48 lines
961 B
PowerShell
48 lines
961 B
PowerShell
# Script by Timur@0x01337.com
|
|
# Date: 2023-11-24
|
|
<#
|
|
.DESCRIPTION
|
|
Displays the detailed information about the hardware and operating system.
|
|
|
|
.PARAMETER help
|
|
Displays a detailed usage description of this script.
|
|
|
|
.EXAMPLE
|
|
PS> .\Get-System-Information.ps1
|
|
|
|
.EXAMPLE
|
|
PS> .\Get-System-Information.ps1 -help
|
|
#>
|
|
|
|
# Getting command line parameters
|
|
param (
|
|
[parameter(Mandatory = $false)][switch]$help
|
|
)
|
|
|
|
# Writing help message
|
|
if ($help) {
|
|
get-help $MyInvocation.MyCommand.Path -Full
|
|
exit 0
|
|
}
|
|
|
|
$command = "systeminfo"
|
|
|
|
Write-Host "Running $command"
|
|
try {
|
|
$process = Start-Process -Wait -PassThru -NoNewWindow -FilePath $command
|
|
}
|
|
catch {
|
|
Write-Error "$_, exit code: $($process.ExitCode)"
|
|
exit 1
|
|
}
|
|
|
|
if (!$process -or $process.ExitCode -ne 0) {
|
|
Write-Error "$command failed, exit code: $($process.ExitCode)"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "$command finished, exit code: $($process.ExitCode)"
|
|
exit 0
|
|
|
|
|