Skip to content

Commit

Permalink
Update list_software_and_resources.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
dannykrouk authored May 11, 2022
1 parent 99e9bc1 commit 0264262
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions list_software_and_resources.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Exports a list of software installed, processor information, memory information, ODBC drivers, and ODBC Dsns on the target machine
# Exports a list of software installed, running services, processor information, memory information, volume information, ODBC drivers, and ODBC Dsns on the target machine
# (default is localhost)
#
# Usage Example
Expand All @@ -11,19 +11,31 @@ param (
[Parameter(Position=0)][string]$machine="localhost"
)

if ($machine -eq "localhost")
{
$machineName = hostname
}
else
{
$machineName = $machine
}

Get-WmiObject -ComputerName $machine -Class Win32_Product | select-object -property name,version | Export-Csv "$($machine)_installed_software.csv" -NoTypeInformation
Get-WmiObject -ComputerName $machine -Class Win32_Processor | select-object -property name,numberofcores,numberoflogicalprocessors | Export-Csv "$($machine)_processors.csv" -NoTypeInformation
Get-WmiObject -ComputerName $machine -Class Win32_PhysicalMemory | select-object -property name,capacity | Export-Csv "$($machine)_memory.csv" -NoTypeInformation
Get-WmiObject -ComputerName $machineName -Class Win32_Product | select-object -property name,version | Export-Csv "$($machineName)_installed_software.csv" -NoTypeInformation
Get-WmiObject -ComputerName $machineName -Class Win32_Processor | select-object -property name,numberofcores,numberoflogicalprocessors | Export-Csv "$($machineName)_processors.csv" -NoTypeInformation
Get-WmiObject -ComputerName $machineName -Class Win32_PhysicalMemory | select-object -property name,capacity | Export-Csv "$($machineName)_memory.csv" -NoTypeInformation
get-service -computername $machineName | Where{$_.Status -eq "Running"} | select-object -Property Name, DisplayName, ServiceName, Status, StartType | Export-Csv "$($machineName)_running_services.csv" -NoTypeInformation

if ($machine -eq "localhost")
{
Get-OdbcDriver | select-object -Property Name, Platform | Export-Csv "$($machine)_odbcdrivers.csv" -NoTypeInformation
Get-OdbcDsn | select-object -Property DriverName, DsnType, Name, Platform | Export-Csv "$($machine)_odbcdsns.csv" -NoTypeInformation

Get-OdbcDriver | select-object -Property Name, Platform | Export-Csv "$($machineName)_odbcdrivers.csv" -NoTypeInformation
Get-OdbcDsn | select-object -Property DriverName, DsnType, Name, Platform | Export-Csv "$($machineName)_odbcdsns.csv" -NoTypeInformation
get-volume | select-object -Property HealthStatus, DriveType, FileSystemType, AllocationUnitSize, DriveLetter, FileSystem, FileSystemLabel, Size, SizeRemaining | Export-Csv "$($machineName)_volumes.csv" -NoTypeInformation
}
else
{
$sess = New-CimSession -ComputerName $machine
Get-OdbcDriver -CimSession $sess | select-object -Property Name, Platform | Export-Csv "$($machine)_odbcdrivers.csv" -NoTypeInformation
Get-OdbcDsn -CimSession $sess | select-object -Property DriverName, DsnType, Name, Platform | Export-Csv "$($machine)_odbcdsns.csv" -NoTypeInformation
get-volume -CimSession $sess | select-object -Property HealthStatus, DriveType, FileSystemType, AllocationUnitSize, DriveLetter, FileSystem, FileSystemLabel, Size, SizeRemaining | Export-Csv "$($machine)_volumes.csv" -NoTypeInformation
}

0 comments on commit 0264262

Please sign in to comment.