checks on newly deployed servers

I have just been given 30 new 2012R2 servers for a new project.

My first thing to do is to check all machines are all built the same

I have not written any powershell before! and was thinking a script i can point at the server and generate a txt file with the results would help me confirm all servers are the same!

I know this is a big ask as there are lots of checks i want to do, perhaps someone can at least start me off?

FQDN of machine
Drive space / letters
local admin groups
computer group membership in AD
object location in AD
machine spec
pagefile size/location
windows update status
Widnows activation status
check any services have failed to start
ip address/Subnet/DG
DNS and search suffix
local firewall status
list windows roles and features installed

  • You will need PowerShell remoteing enabled for this kind of effort.
     There several pre-built scripts on the Microsoft PowerShell Gallery you can leverage as well. No reason to do this from scratch.

     'www.powershellgallery.com'
     Just search for what you need: 'www.powershellgallery.com/items?q=inventory&x=0&y=0'

     You can even do that kind of search directly on this site as we have had many questions like this which we have responded to.

     For example:

    'community.idera.com/search?q=Drive%20space'
    'community.idera.com/search?q=computer%20group%20membership'
    'community.idera.com/search?q=remote%20computer%20inventory'

     So, literally, just type your points or variations of them in the search and you will see several hits to start you adventure.

     I have written something like this for my customers, but way to large to post here. So, my suggestion above would be your most prudent approach.

     You can do a search on each point one at a time, then merge it as one script.

  • Thought I'd come back with a bit more.
    I my script (an enterprise detail level scan of an environment, not just computer stuff - hundreds of lines of code) I mention in the previous post and cropped out the point specific info you are after to assist you further. So around 90 lines including blank lines and not a lot of formatting. So, you'll need to address that.

    HTH, or decreases your research / search time suggested in my previous post.

    Again, you will need the AD module loaded (implicit or explicit) for a few items you are after.

    # I also meant to add, you can get most of this just by using systeminfo.exe
    systeminfo
    # But doing this sort of thing, to get the most granular details, you'll get your head around these
    # WMI Classes
    # 'msdn.microsoft.com/en-us/library/aa394084(v=vs.85).aspx'

    # CIM Classes
    # msdn.microsoft.com/en-us/library/aa386179(v=vs.85).aspx'

    "System Information Summary"
    "Generated $(Get-Date)"
    "#"*80
    ""
    ""

    "#"*80
    "Computer System Information"
    "#"*80

    # FQDN of machine
    ([System.Net.Dns]::GetHostByName(($env:computerName))).HostName


    # Drive space / letters
    Get-wmiobject -Class Win32_LogicalDisk | Where DriveType -eq 3 | Select -Property *


    # local admin groups
    net localgroup administrators


    # computer group membership in AD
    # Computers are normally in AD OU, users are normally in groups
    Get-ADComputer -Identity $env:computerName | Select -Property *


    # object location in AD
    Get-ADComputer -Identity $env:computerName | Select -Property *


    # machine spec
    Get-wmiobject -Class Win32_ComputerSystem | Select -Property *
    Get-wmiobject -Class Win32_BIOS | Select -Property *
    Get-wmiobject -Class Win32_OperatingSystem | Select -Property *
    Get-wmiobject -Class Win32_Processor | Select -Property *
    Get-wmiobject -Class Win32_PhysicalMemory | Select -Property *
    Get-wmiobject -Class Win32_DiskDrive | Select -Property *
    Get-wmiobject -Class Win32_LogicalDisk | Where DriveType -eq 3 | Select -Property *
    Get-wmiobject -Class Win32_NetworkAdapterConfiguration | Where{ $_.IPEnabled -eq "True"} | Select -Property *
    Get-ChildItem -Path env:\


    # pagefile size/location
    Get-wmiobject -Class Win32_PageFile | Select -Property *
    Get-wmiobject -Class Win32_PageFileusage | Select -Property *


    # windows update status
    # I am going to assume you mena patch level here
    ((New-Object -ComObject Microsoft.Update.Session).CreateUpdateSearcher()).Search("IsInstalled=1").Updates | ft -a Date,Title
    # But here are other items of interest
    [version](New-Object -ComObject Microsoft.Update.AgentInfo).GetInfo('ProductVersionString')
    (New-Object -com "Microsoft.Update.AutoUpdate").settings


    # Widnows activation status
    Get-WmiObject -Class SoftwareLicensingProduct -ComputerName $env:computerName `
    -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'" |
    where licensestatus -eq 1 |
    Select name, description, @{Label='computer';
    Expression = {$_.PscomputerName}} |
    Format-List name, description, computer


    # check any services have failed to start
    Get-Service | Where Status -eq "Stopped"


    # ip address/Subnet/DG
    (Get-wmiobject -Class Win32_NetworkAdapterConfiguration | Where{ $_.IPEnabled -eq "True"} | Select -Property *).IPAddress
    (Get-wmiobject -Class Win32_NetworkAdapterConfiguration | Where{ $_.IPEnabled -eq "True"} | Select -Property *).IPSubnet
    (Get-wmiobject -Class Win32_NetworkAdapterConfiguration | Where{ $_.IPEnabled -eq "True"} | Select -Property *).DefaultIPGateway


    # DNS and search suffix
    (Get-wmiobject -Class Win32_NetworkAdapterConfiguration | Where{ $_.IPEnabled -eq "True"} | Select -Property *).DNSDomainSuffixSearchOrder

    # local firewall status
    Get-NetFirewallProfile

    # list windows roles and features installed
    Get-WindowsFeature | Where-Object {$_.Installed -match “True”}