Today’s Helpful Function of the Day is a great one to store in your profile. (Don’t know how to create or update your own custom profile? Read this.) It’s syntax is a simple as:

Get-MyServer SERVERNAME

It returns server information such as Operating System Version and Service Pack, Active Directory Description and Parent Container (Organizational Unit) and the Model of the computer (e.g. Proliant DL380 G3).
It also supports the use of wildcards in a server name. It will return the same info for all matches.

All of that in just 4 lines of powershell code. Gotta love it!

Get-MyServer (Rename to .ps1)

»crosslinked«

Tagged with:
 

2 Responses to Really Quick Server Info

  1. Sumit Gupta says:

    Hi,

    i am getting the below error when i run this script.

    The term ‘Get-QADComputer’ is not recognized as a cmdlet, function, operable program, or script file. Verify the term a
    nd try again.
    At C:\get-myserver.ps1:5 char:22
    + Else {Get-QADComputer <<<< -searchRoot “OU=Servers,DC=MYDOMAIN,DC=LOCAL” -name $ServerName -sizeLimit 0 | Select-Obj
    ect Name, Description, OSName, OSServicePack, ParentContainer, @{N=”Model”;E={(Get-WmiObject -Class Win32_ComputerSyste
    m -ComputerName $_.Name).Model}}}

    Could you please help?

    Regards

    Sumit

  2. admin says:

    Hi Sumit,

    Looks like you are missing the Quest AD snapin.
    Download it at : http://www.quest.com/activeroles-server/arms.aspx and add it using add-pssnapin.
    Good luck!
    Hugo

Leave a Reply