Powershell contains – match on partial string and list?

Viewing 0 reply threads
  • Author
    Posts
    • #178024
      prabakarreddy
      Participant

      I have this situation in my script:

      $Excludes = “Commvault”,”Veeam”

      $testuser = ‘DOMAIN\vCommvaultConnect’
      $Excludes | ForEach-Object {
      If ($testuser.Contains($_)) {
      Write-Host “Found”
      }
      }
      Is this the most efficient way to test commvault for this or is there a faster way to match a user to each of those excluded words?

Viewing 0 reply threads
  • You must be logged in to reply to this topic.

Copyright ©2020 Caendra, Inc.

Contact Us

Thoughts, suggestions, issues? Send us an email, and we'll get back to you.

Sending

Sign in with Caendra

Forgot password?Sign up

Forgot your details?