mardi 10 mars 2015

Powershell : Server's remote inventory

Hi !

Frequently, when working with technology, you have to inventory servers. You might need reports on group of server for particular jobs.

I developed a small script which lists of your servers.

It needs a CSV file which consists of a single column like this:

ServerName
Server1
Server2
Server3
[...]

Output is in an excel file that you can then use at will.

Enjoy !

Download the script.


<# ==============================================================================================

    Name : Server Inventory (Get-ServerInventory.ps1)
    Description : Get informations from remote servers with WMI and ouput in an Excel File                

    Author : Pierre-Alexandre Braeken
    Date : 10 March 2015   
    Thanks : Jesse Hamrick (https://gist.github.com/BDollar/5455098)
             https://social.technet.microsoft.com/Forums/windowsserver/en-US/6bfeeb89-8fa8-4e6b-8588-cabe7f7291ea/excel-with-powershell-and-this-big-problem-of-locale
             http://stackoverflow.com/questions/4105224/how-to-set-culture-in-powershell
   
    * Select list of servers from a CSV file with an OpenFileDialog
    * Get remotely Servers informations with WMI and Powershell :
    * General (Domain, role in the domain, hardware manufacturer, type and model, cpu number, memory capacity, operating system and sp level)
    * System (BIOS name, BIOS version, hardware serial number, time zone, WMI version, virtual memory file location, virtual memory current usage, virtual memory peak usage and virtual memory allocated)
    * Processor (Processor(s), processor type, family, speed in Mhz, cache size in GB and socket number)
    * Memory (Bank number, label, capacity in GB, form and type)
    * Disk (Disk type, letter, capacity in GB, free space in GB + display a chart Excel)
    * Network (Network card, DHCP enable or not, Ip address, subnet mask, default gateway, Dns servers, Dns registered or not, primary and secondary wins and wins lookup or not)
    * Installed Programs (Display name, version, install location and publisher)
    * Share swith NTFS rights (Share name, user account, rights, ace flags and ace type)
    * Services (Display name, name, start by, start mode and path name)
    * Scheduled Tasks (Name, last run time, next run time and run as)
    * Printers (Locationm, name, printer state and status, share name and system name)
    * Process (Name, Path and sessionID)
    * Local Users (Groups, users)
    * ODBC Configured (dsn, Server, Port, DatabaseFile, DatabaseName, UID, PWD, Start, LastUser, Database, DefaultLibraries, DefaultPackage, DefaultPkgLibrary, System, Driver, Description)
    * ODBC Drivers Installed (Driver, DriverODBCVer, FileExtns, Setup)   
    * MB to GB conversion
    * Display of the progress of the script

# ============================================================================================== #>

Aucun commentaire:

Enregistrer un commentaire