Programming

PowerShell: Get Computer Software and Version

Posted on Updated on


Something that I have found useful in getting a hard copy of is a computers installed software, vendor and version. Today I’m just going to work with the local computer. In another post I will talk about the ability to get all software installed on a group of computers. In PowerShell there are a few ways to do what I am going to show you. The one I prefer is Get-CimInstance. I use this over Get-WMIObject becasue it gets me more information and Get-WMIObject is actually the older way from PS 2.0. It has really been replaced with Get-CimInstance. If you go to Introduction to CIM Cmdlets (MSDN Blog) you will find this quote:

“Getting/Enumerating instance of a class is the most commonly performed operation. We wanted the new Get-CimInstance Cmdlet to have better performance and even better user experience as compared to the old Get-WmiObject cmdlet. To achieve these goals we made the following design decisions:”

So, how do I write the code?

Get-ciminstance Win32_Product

or

Gcim Win32_Product (gcim is the alias for Get-Ciminstance)

That just spits out the information in the ugly format below:

PS_Capture

I like my data so I can read it properly and with all the data I really want. Lets add a Piped command:

| Format-Table name, version, vendor

This gives you the results below:

PS_Capture1

Okay, so that’s nice, but how about in a CSV file that I can print or look at later? Cool, lets do it:

Gcim Win32_Product | Select-Object name, version, vendor | Export-Csv C:\software1.csv

I know, your saying wait you changed the second line from Format-Table to Select-Object and you would be correct. Why did I change it, well format-Table is for output to the console, not for something you are piping to Export-CSV. You have to Select the Objects you want to send to the CSV file to get proper data. Go ahead and try to use the Format-Table once to see you get nothing you can use in the CSV file. The output you get when you use the Select-Object is below. That’s how I would like it, how about you?

PS_Capture3

Advertisements

Blogging From Google+

Posted on Updated on


I’ve been watching my stream in Google+ and have seen some talk about using it as a blogging tool. If you also have +Mike Elgan in your circles you have seen his great piece on “If This Then That” or IFTTT for short. That article has gotten my programming juices going to play with different tasks to create what IFTTT calls recipes.

One recipe has worked great for me, which is to send my Google Calendar alerts to my stream through my Gmail/Google Voice SMS. You can find the recipe here: http://ifttt.com/recipes/4413 I’ve also created a task to have my Twitter posts sent to Google+ and my G+ to Facebook. I have not made them into recipes yet, but will when I feel they are working well enough for me.

So, where does this take me with blogging in Google+ you ask. Well, IFTTT has a WordPress channel. This is the test post for that action, where I am using the G+ RSS feed to trigger an action in the WordPress channel when I use a keyword in a G+ post. I’ve decided to use the keyword trigger at the end of the this post to keep it out of the way of the content. While the post going to WordPress won’t have a category or tags, I can add them later or I will look at how I can add them automatically.

Keep a look out for more about how this goes. I will definitely let everyone know the outcome.

Edutechation

from Ray Ebersole – Google+

Post Feed https://plus.google.com/116971187524635952368/posts/atXQ5x1gxeK

Hack Your Firefox Extensions To Work With Any New Update

Posted on Updated on


UPDATE

With Nightly 7.0a1 you have to be EXACT with the version. DO NOT use a WILDCARD *

I use a nightly version of Firefox and even the stable versions break your favorite extensions from time to time. I use an Extension called Nightly Tester Tools that forces compatibility 99% of the time, but for the one percent that it doesn’t work with I have to hack the code for the extension. It’s really not that hard, the actual extension installs are nothing but ZIP files. Step by step, here is how you get your favorite extension to work with your Firefox if it breaks.

  1. Right click the extension download and select “save link as”
  2. One you have saved the extension to your computer (XPI file) open it with your favorite archive program. (I use 7-Zip)
  3. Inside the XPI file will be a file called Install.rdf. This file you can open with a text editor. (I use Notepad++)
  4. In your editor, you will see code like this:

<!– FireFox –>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>4.0b8pre</em:maxVersion>
</Description>
</em:targetApplication>

Where it says <em:maxVersion> change the version number to the current version of Firefox you are using or to 4.* which will wildcard all versions of Firefox 4. Once you have changed the number, save the file and add it back to the XPI archive. Now, you can right click the XPI, open it with Firefox and install it.

You will now have a working extension, enjoy!