Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with Variables

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
I am working on extracting a variable with powershell for a Citrix farm.

I use:

$farmname = Get-XAFarm | Select-Object farmname

this puts the below into the variable

FarmName
--------
MY FARM NAME HERE

I just need to pull the farm name itself or trim the rest off. So i don't need:

FarmName
--------

Is there a way to only get what I need?

 
What do you get with:

Code:
$farmname = Get-XAFarm


Light travels faster than sound. That's why some people appear bright until you hear them speak.
 
Show us the contents of the function Get-XAFarm.



-Carl
"The glass is neither half-full nor half-empty: it's twice as big as it needs to be."

[tab][navy]For this site's posting policies, click [/navy]here.
 
Carl,
I'm sure what you're asking for. Get-XAFarm is a cmdlet from the Citrix XenApp snapin

However, this is what I get when I run the command:

Code:
## Add Citrix Snapin
Add-PSSnapin Citrix.XenApp.Commands

## Get the farm object
PS C:\> $farm = Get-XAFarm
PS C:\> $farm
[indent][i]
FarmName          : <My Farm Name>
ServerVersion     : 6.5.0
AdministratorType : Full
MachineName       : <My Server>
[/i][/indent]

## Get the farm name as a string
PS C:\> $farmname = $farm.farmname
PS C:\> $farmname

[indent][i]<My Farm Name>[/i][/indent]


Light travels faster than sound. That's why some people appear bright until you hear them speak.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top