Get Machine Name

  • Hi,

    I need to return the current name of the machine i'm running my script on please.

    I know how to do this for a standalone machine, but this is a cluster of 3 servers. I need the cluster name - NOT the individual node name. 

    Thanks

  • I typed "powershell get cluster name" into my favourite search engine, and the first result appeared to answer your question.

    John

  • Already seen that but Im not looking for a list of values. I just need the name.

    Get-Cluster | fl * 
  • Luckily, Name is one of the properties that the command returns:

    Get-Cluster | fl * 

    Domain         : contoso.com
    Name          : cluster1
    FixQuorum        : 0
    SharedVolumesRoot      : C:\ClusterStorage
    DefaultNetworkRole     : 2
    Description        :
    QuorumArbitrationTimeMax   : 20
    ClusSvcHangTimeout     : 60
    ClusSvcRegroupStageTimeout   : 7
    ClusSvcRegroupOpeningTimeout  : 5
    ClusSvcRegroupPruningTimeout  : 5
    ClusSvcRegroupTickInMilliseconds : 300
    HangRecoveryAction     : 3
    SameSubnetDelay      : 1000
    CrossSubnetDelay      : 1000
    SameSubnetThreshold     : 5
    PlumbAllCrossSubnetRoutes   : 0
    CrossSubnetThreshold     : 5
    BackupInProgress      : 0
    RequestReplyTimeout     : 60
    WitnessRestartInterval    : 15
    SecurityLevel       : 1
    ClusterLogLevel      : 3
    ClusterLogSize       : 100
    WitnessDatabaseWriteTimeout  : 300
    AddEvictDelay       : 60
    EnableSharedVolumes     : Enabled
    Id           : 655d3640-2845-4077-a396-9f317f2df60e


    If the Name property is all you require, try searching for "powershell where".  This is how I learned PowerShell - by working out how to do things as and when the need arose.

    John

  • Thanks, but that's not what I'm looking for. I don't need it to be equal to a specific value. I just need the cluster name.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply