Help with Powershell Inventory

Good morning, first of all I apologize for any spelling mistakes, I am using a translator.
Since now I hope that everything is fine with everyone who sees this post, and here is my situation.
In my job I am a server administrator and I am now starting to enter the world of powershell, of which, I understand very little. And I want to make a complete inventory of the machines that I have in network in the company, I know that there is a script in powershell that can do this to me, I already researched a lot and I was never able to find what I really needed, so I am using this forum.
The idea was a script that would give me information about the version of the office you have installed, the amount of RAM memory, the size and free space you have on disk, the model and name of the computer and its respective serial number (way of viewing whether it is a laptop or desktop) and also the peripherals ie mouse keyboard and monitors, with their models and serial number if possible. Also have a user who is currently on the computer. And in the end, export to an excel file.

Something a little like the print that I made available in the post. This I achieved through the website spiceworks.com which has an inventory option, so it does not meet all my needs and I have to install an agent which does not facilitate the process.

Can anyone help me with this? Is this even possible? I am immensely grateful for all the help you can give me in relation to this situation.

I found an example of a script that a colleague previous to me had made and it is something like this. The problem is that my colleague does not know where the script is. But it was something he wanted.

UserName Department Plataforma LASO Name MacAddress IPAddress Chassis Manufacturer Model SerialNumber CPU Memory Physical Disk Size GB Free Disk Space GB OSName OSVersion OSServicePack OSInstallDate OSSerialNumber OSArchitecture Microsoft Office Microsoft Office Version DotNetVersions BiosVersion BiosManufacturer Monitor Manufacturer Monitor Model Monitor Description Monitor Serial Number Anti-Virus Software Anti-Virus Database Version
Pedro Fatela Sistemas de Informação Casais da Serra ATC1 64:00:6A:33:2A:DE 172.16.1.87 Desktop Dell Inc. OptiPlex 7040 F3LFCC2 Intel Core i7-6700 CPU @ 3.40GHz 8 GB 454 128 Microsoft Windows 7 Professional 6.1.7601 1 14/12/2016 13:24 00371-OEM-8992671-00524 X64 Microsoft Office Casa e Negócios 2016 - pt-pt 16.0.11029.20079 2.0 SP 2, 3.0 SP 2, 3.5 SP 1, 4.0 Client, 4.0 Full, 4.7.2 1.2.8 Dell Inc. AUS ASUS VP278 Monitor PnP Genérico HBLMTF204274

Welcome to the forums. What kind of help do you need? Most of your requirements are easily possible. But there are literally thousands of examples for tasks like this. Even here on this forum. Another great source for Powershell code is the
https://www.powershellgallery.com

We will be happy to assist with code you wrote by yourself but we will not write the code for you. :wink:

1 Like

Thank you very much for your attention.

I did a lot of research, for a few good days before writing this post, I didn’t find what I wanted and then, I don’t have so much ease in manipulating code to adapt some code to this need. I already found code that shows disk space but all of this was only locally for one machine and I was never able to export or gather the information

It is pretty unlikely that you will find something perfectly fitting for your particular needs. But if don’t like to learn to do it yourself and if you don’t like to hire a trained IT professional to do it for you you’re pretty much out of luck, sorry.

I tried to use this: PowerShell Gallery | AssetInventory 1.0.1.6

But I don’t understand how it works or what I need to do.

You may start with learning the very basics of Powershell first. One still good starting point would be this: Getting Started with PowerShell 3.0

2 Likes

I took a QUICK look at the script you linked from the PS Gallery. At first glance, it looks like it will do most of what you want. This might get you started. Keep in mind, the AssetInventory script uses PowerShell remoting so you need to figure that out and make sure you run the script as an admin user for all the systems you want to query. Also, I HAVE no way to extensively test this, but an initial test worked for me with the script below.

Download the package you reference ( I am guessing you have done this already), then extract to a folder. You could install the module as instructed on the web site, however, I think you can learn better this way.

In that folder, create a file with the hostnames (one per line) that you want to query. Call the file “hosts.txt”
Then, using this very crude example of a starter script below, create this script in the same folder as the PSM1 and the hosts.txt file. Save it to file name of your liking, then run it. As an example, I saved the file as “Get-Inventory.PS1”. If you choose that same file name, in an admin powershell as a user with admin permissions on all the hosts in your list, enter the following: “.\Get-Inventory.PS1”. This assumes you have set your ExecutionPolicy to “RemoteSigned”.

Import-Module -Name '.\AssetInventory.PSM1'

$hosts = Get-Content -Path '.\hosts.txt'

$hosts | foreach {
	Get-AssetInventory -ComputerName $_
}

From there, you are on your own as the output formats can be configured as XML or JSON. Have a look at the arguments for that. I also have to say, the AssetInventory Module is very well written. Kudos to the guy that wrote it.