About
Pricing
Community
Teams
Start Free Trial
Log in
bibi92
asked on
1/3/2013
powershell get sql virtual
Hello,
When I execute this powershell function :
function Get-ClusterSQL
{
param($cluster)
gwmi -class "MSCluster_Resource" -namespace "root\mscluster" -computername $cluster | where {$_.type -eq "SQL Server"} | Select @{n='VirtualServerName';e=
{$_.Privat
ePropertie
s.VirtualS
erverName}
}, @{n='InstanceName';e={$_.P
rivateProp
erties.Ins
tanceName}
}, `
@{n='ServerInstance';e={("
{0}\{1}" -f $_.PrivateProperties.Virtu
alServerNa
me,$_.Priv
atePropert
ies.Instan
ceName).Tr
imEnd('\')
}}
}
The result is
VirtualServerName InstanceName ServerInstance
----------------- ------------ --------------
Test Test12 Test\Test12
How can I modify the function for having the result test\test12?
Thanks
Regards
bibi
Microsoft SQL Server 2008
Powershell
5
1
Last Comment
bibi92
8/22/2022 - Mon
TempDBA
1/3/2013
Not clear with your question. Please explain a bit more.
bibi92
1/3/2013
ASKER
I search how I can modify the function for display only test\test12 and not
ServerInstance
--------------
test\test12
Thanks
bibi
SubSun
1/3/2013
Does this work?
Get-ClusterSQL Cluster | Select -ExpandProperty ServerInstance
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
SubSun
1/3/2013
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
bibi92
1/4/2013
ASKER
Thanks regards bibi