Skip to content

Instantly share code, notes, and snippets.

@torgro
Created October 28, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torgro/50dacd91ad718dd9b336 to your computer and use it in GitHub Desktop.
Save torgro/50dacd91ad718dd9b336 to your computer and use it in GitHub Desktop.
foreach ($vdi in $vdis)
{
$n = $vdi.name
$AdComputer = Get-ADComputer -identity $n -ErrorAction SilentlyContinue
$Citrix = Get-BrokerMachine -HostedMachineName $n #-ErrorAction SilentlyContinue
$VmWare = Get-ProvVM -VMName $n #-ErrorAction SilentlyContinue
if($AdComputer)
{
#Exists in AD, do action here, read from console what ever
}
if($Citrix)
{
#Exists in Citrix, do action here, read from console what ever
}
if($VmWare)
{
#Exists in VmWare, do action here, read from console what ever
}
#Or all together
if($AdComputer -or $Citrix -or $VmWare)
{
#One the objects are not null, do action
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment