Jump to content
Welcome to our new Citrix community!
  • 0

powershell create a dedicated machine list of each catalog


Wim Guijt

Question

It's my intention to create a dedicated machine.txt file off each Catalog

Add-PSSnapin Citrix*
$file = "c:\tmp\allCatolog.txt"
get-brokerCatalog -adminaddress dcd002.domain.com |select -ExpandProperty name |out-file $file
$Catalog = Get-Content $file
Foreach ($_ in Get-ChildItem $File)
 {
Get-BrokerDesktop -adminaddress dcd002.domain.com -Filter{CatalogName -eq $_ } | Select-Object -Property HostedMachineName

I receive no error, but also no result.

When I replace the $_ with a catalog name, it works.
How can I solve this?

Link to comment

3 answers to this question

Recommended Posts

  • 0

Try something like this:

Add-PSSnapin Citrix*

$file = "c:\tmp\allCatalogs.txt"

$catalogs = Get-BrokerCatalog -adminaddress dcd002.domain.com

$catalogs |select -ExpandProperty name |out-file $file

Foreach ($catalog in $catalogs) {

  Get-BrokerDesktop -adminaddress dcd002.domain.com -CatalogName $catalog.name | Select-Object -Property HostedMachineName | out-file "c:\tmp\${$catalog.name}.txt"

}

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...