Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Use a specfic string that is one of many strings output from a command as variable

$
0
0

Hi, Sorry about a bad title. Didnt know how to title this question.

The case is that I want to run this command in a script for users in different domains: Test-CsAddressBookWebQuery -TargetFqdn $TargetFqdn -UserSipAddress User1$SipDomain -TargetSipAddress User2$SipDomain.

My problem is retrieving the $SipDomain from another command correctly.

I am using the 

Get-CsSipDomain which gives out put like this:

Identity                   Name                                       IsDefault
--------                   ----                                       ---------
somestring   somestring2                  True
somestring3            somestring4                        False

"somestring" is the string I need to get into $SipDomain variable.

I have tried to do 

$SipDomain = Get-CsSipDomain | Where-Object {$_.Isdefault -eq $true} | Select-Object Identity

which gives me output

Identity
--------
somestring

But this does not work in the first command as $SipDomain as I only need the string "somestring" in the variable.

Any tips to how I can achieve my goal?

Would be much apreciated! :)


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>