title: New-Object : A parameter cannot be found that matches parameter name 'Property'. Powershell 2.0 Windows 2008
body: <p>I'm using this code in 2012 server but unable to run in windows 2008, i'm new to powershell script which tried to search online but unable to find an answer.</p>
  
  <p>The error come from -property, which i tried -properties and pipe before -property also can't.</p>
  
  <pre><code>$OS = Get-WmiObject Win32_OperatingSystem | Select-Object Caption,Version,ServicePackMajorVersion,OSArchitecture,CSName,WindowsDirectory
  $HostName = [System.Net.Dns]::GetHostName()
  $TargetPath = Get-Location
  $ExportPath = $TargetPath.Path + "\" + $HostName + "_" + $OS.Caption + ".csv"
  $UserAccount = Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'"
  $NetworkLoginProfile = Get-WmiObject -Class Win32_NetworkLoginProfile
  $GroupUser = Get-WmiObject -Class Win32_GroupUser
  
  if (Test-Path $ExportPath) 
  {
      Remove-Item $ExportPath
  }
  
  Foreach($Account in $UserAccount){
  
      $Description = $Account.Description
      $Description = $Description.replace("`r`n","_")
      $Description = $Description.TrimEnd()
  
      $Profile = @{
          HostName = $HostName
          Domain = $Account.Domain    
          LocalAccount = $Account.LocalAccount    
          SID = $Account.SID  
          Name = $Account.Name    
          Caption = $Account.Caption  
          Status = $Account.Status    
          Disabled = $Account.Disabled    
          Lockout = $Account.Lockout
          FullName = $Account.FullName    
          Description = $Description  
          AccountType = $Account.AccountType  
          PasswordRequired = $Account.PasswordRequired    
          PasswordExpires = $Account.PasswordExpires  
          PasswordChangeable = $Account.PasswordChangeable    
          NumberOfLogons = ""
          LastLogon = ""
          UserComment = ""
          UserId = ""
          UserType = ""
          Workstations = ""
          BadPasswordCount = ""
          GroupMemberShip = ""
      }
  
      Foreach ($NetworkProfile in $NetworkLoginProfile)
      {
          If ($Account.Caption -eq $NetworkProfile.Name)
          {
              $Profile.NumberOfLogons = $NetworkProfile.NumberOfLogons
              $Profile.LastLogon = $NetworkProfile.LastLogon
              $Profile.UserComment = $NetworkProfile.UserComment
              $Profile.UserID = $NetworkProfile.UserId
              $Profile.UserType = $NetworkProfile.UserType
              $Profile.Workstations = $NetworkProfile.Workstations
              $Profile.BadPasswordCount = $NetworkProfile.BadPasswordCount
          }
      }
  
      $Groups = New-Object System.Collections.ArrayList
  
      Foreach ($User in $GroupUser)
      {
  
          $PartComponent = $User.PartComponent
  
          $Index1 = $PartComponent.indexOf("Name=")
          $MemberName = $PartComponent.substring($Index1)
          $MemberName = $MemberName.substring(6)
          $MemberName = $MemberName.subString(0, $MemberName.indexOf("`""))
  
          $Index2 = $PartComponent.indexOf("Domain=")
          $MemberDomain = $PartComponent.subString($Index2)
          $MemberDomain = $MemberDomain.substring(8)
          $MemberDomain = $MemberDomain.substring(0, $MemberDomain.indexOf("`""))
  
          if (($MemberDomain -eq $Account.Domain) -and ($MemberName -eq $Account.Name))
          {
              $GroupComponent = $User.GroupComponent
  
              $Index3 = $GroupComponent.indexOf("Name=")
              $MemberGroup = $GroupComponent.substring($Index3)
              $MemberGroup = $MemberGroup.substring(6)
              $MemberGroup = $MemberGroup.subString(0, $MemberGroup.indexOf("`""))
  
              if($MemberGroup)
              {
                  $Groups.Add($MemberGroup)
              }
          }
      }
  
      $count = 0
  
      Foreach ($Group in $Groups)
      {
          $count++
  
          if($count -lt $Groups.Count){
              $Profile.GroupMemberShip += $Group + '|'
          }
          else{
              $Profile.GroupMemberShip += $Group
          }      
      }      
  
      $Csv = New-Object psobject -Property $Profile
      $Csv | Select-Object -Property Hostname,Domain,LocalAccount,SID,Name,Caption,Status,Disabled,Lockout,FullName,Description,AccountType,PasswordRequired,PasswordExpires,PasswordChangeable,NumberOfLogons,LastLogon,UserComment,UserId,UserType,Workstations,BadPasswordCount,GroupMemberShip | Export-Csv $ExportPath -Append -Delimiter ',' -NoTypeInformation
  }
  </code></pre>
  
  <p>Error I receive:</p>
  
  <p><a href="https://i.stack.imgur.com/7mv0V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7mv0V.png" alt="enter image description here"></a></p>