Announcement

Collapse
No announcement yet.

Finding objects that match * or *

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Finding objects that match * or *

    How do i search on multiple parameters in Powershell?

    For example Lync. I want to search all users that have either sipaddress 1 or sipaddress 2?

    I tried following:
    Get-csuser | select-string -pattern "*Sipdomain 1", "Sipdomain 2" | fl displayname, sipdomain

    Get-csuser | where {$_.sipdomain -like "*Sipdomain 1"} | where {$_.sipdomain -like "*Sipdomain 2"} | fl displayname, sipdomain

    And what do i use when i want to find objects that own multiple attributes
    example:

    Get-csaduser | where {$_Homeserver -eq "OCSServer}&{$_.Sipaddress -like "$SipDomain 1" | fl displayname, sipaddress, Homeserver
    [Powershell]
    Start-DayDream
    Set-Location Malibu Beach
    Get-Drink
    Lay-Back
    Start-Sleep
    ....
    Wake-Up!
    Resume-Service
    Write-Warning
    [/Powershell]

    BLOG: Therealshrimp.blogspot.com

  • #2
    Re: Finding objects that match * or *

    use the -or parameter:
    http://technet.microsoft.com/en-us/l.../ee177028.aspx
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Finding objects that match * or *

      Thx Ossian

      Get-csuser | where {$_.sipdomain -like "*Sipdomain 1" -or $_.sipdomain -like "*Sipdomain 2"} | fl displayname, sipdomain

      Get-csaduser | where {$_Homeserver -eq "OCSServer -and $_.Sipaddress -like "$SipDomain 1" | fl displayname, sipaddress, Homeserver
      [Powershell]
      Start-DayDream
      Set-Location Malibu Beach
      Get-Drink
      Lay-Back
      Start-Sleep
      ....
      Wake-Up!
      Resume-Service
      Write-Warning
      [/Powershell]

      BLOG: Therealshrimp.blogspot.com

      Comment

      Working...
      X