Code: Select all
$MyList = @()
$TDApps = "" | Select-Object Comptr, OS, username, SoftwareVersion Software2Version, Software3Version, Software4Version, Software5Version, Software5Version, Software6Ver, Software7Version
if (Test-Path "C:Program (x86)Software") {
$TDApps.Comptr=(Get-wmiobject Win32_ComputerSystem).Name
$TDApps.OS=(Get-wmiobject win32_operatingsystem | Select-Object Version).Version
$TDApps.username=(Get-wmiobject Win32_ComputerSystem).UserName
$TDApps.SoftwareVersion= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.SoftwareVersion= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software2Version= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software3Version = (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software4Version= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software5Version = (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software6Version= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
$TDApps.Software7Version= (. Get-Item "C:Program Files (x86)Software").VersionInfo.ProductVersion
}
$TDApps
[/error]
ERROR: Select-Object : A positional parameter cannot be found that accepts argument 'System.Object[]'.
LastTestCheck.ps1 (11): ERROR: At Line: 11 char: 16
ERROR: + $TDApps = "" | Select-Object Comptr, OS, username, SoftwareVersion Software2Version, Software3Version, ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidArgument: (:) [Select-Object], ParameterBindingException
ERROR: + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand