Last updated by at .

  • Microsoft Azure
  • Virtual Machine Manager

Tag: Windows

Install Sysinternals from PowerShell

More about PowerShell OneGet

As already posted and as you can see on my blog, I really like the new feature called OneGet. With the Windows Management Framework 5.0 Preview, Microsoft released a new PowerShell module which is called OneGet.

OneGet is a new way to discover and install software packages from around the web. The way how this works is that you can connect to repositories around the web or you can just add new repositories by your self for example for internal use. In the preview you have the Chocolatey repository connected. I am pretty sure Microsoft will also add some own repositories to the list, so you can install Microsoft software and packages from a trusted source.

You can get all the different repositories with the Get-PackageSource cmdlet.

Get-PackageSource

You can than list all the packages available for you by using Find-Package, or you could use it to find a specific package.

Find_package

If you have found the right package you can also see all the versions available by using the Find-Package <Package> -AllVersions cmdlet.

Find Package Versions

You can now install the version you need or you can just use the Install-Package cmdlet to install the latest available version.

OneGet PowerShell

After you have installed packages you can of course list them by using the Get-Package cmdlet or uninstall a package by using Uninstall-Package.

But this is not everything, another great thing about OneGet is that it can be integrated in PowerShell Desired State Configuration (DSC). So think about it for a moment, you can now create simple server configurations with DSC and you don’t have to think about software repositories at all, OneGet does handle this for you.

By the way, Garrett Serack (Senior Open Source Software Developer at Microsoft) also pointed out to me that OneGet also has a place on the Microsoft Open Source Software site CodePlex.

 

 



Install Sysinternals from PowerShell

Install Sysinternals from PowerShell via OneGet

Microsoft just announced the Windows Management Framework 5.0 Preview. The Windows Management Framework V5 preview adds some cool new feature called OneGet.

OneGet is a new way to discover and install software packages from around the web. With OneGet, you can:
  • Manage a list of software repositories in which packages can be searched, acquired, and installed
  • Search and filter your repositories to find the packages you need
  • Seamlessly install and uninstall packages from one or more repositories with a single PowerShell command

As I did some tests this is perfect to install new software packages very easily. So I started with one of my favorite tools called Sysinternals Suite.

Install Sysinternals from PowerShell

First I have check if there was a Sys internals Package available by using:

This checks online from different sources if there is a package available. After that I installed the package by using:

So this is really easy and guess what, it does not just work for Microsoft Software, there is a lot more of third party Software which can be installed with OneGet. So make sure you checkout the Windows Management Framework 5.0 Preview to get the new OneGet cmdlets.

 



CLIXML Export Import

Save PowerShell Object to file for Remote Troubleshooting

This is not something new to the most of you PowerShell guys out there, but still there are a lot of IT Pros which do not know about this. Sometimes we have to do some remote troubleshooting without having access to the system itself. The thing you can do is to let the customer send you some screenshots but that doesn’t really show everything and maybe you have to contact the customer like 100 times to get the right information. A better solution is to let the customer to run a PowerShell command or script and send you the output. But even a text file or screenshot of the PowerShell output is not the best solution. If you get a lot of text in a TXT file it is hard to sort it and maybe there are some information missing because the txt output does not include all information of the PowerShell object.

I have started to use a simple method to export PowerShell objects to a XML file and import the object on another system. This can be done by the PowerShell cmdlets Export-Clixml and Import-Clixml.

What I do is, I tell the customer to run the following command to generate a XML with the PowerShell objects about his disks for example.

After I got this XML file, I can import it here on my local system and can work with it as I would be in front of the customer system.

CLIXML Export Import

As I said, this is nothing new but this can save you and your customer some time. Of course this works with other objects not just disks ;-) For example you can get Cluster Configurations, Hyper-V Virtual Switch Configurations and much more.

 

 



OneNote Overview

This is why OneNote is awesome

Well I know I normally blog more about Microsoft Datacenter and Cloud stuff especially Hyper-V and System Center, but I am a huge fan of Microsoft’s Office Suite. I really live in Outlook and Microsoft OneNote. I organize my private life, my work and university stuff in OneNote. I get often ask by customers or friends how I work and how I get things done. In this case I always show them OneNote, which is maybe one of the best keep secrets inside Microsoft.This post shows you why OneNote is awesome and shows you some of the hidden features you didn’t know about.

If you have more hidden features leave a comment on the post.

OneNote Dock to Desktop

OneNote Dock to Desktop Title

With the Dock to Desktop feature you can keep your notes visible by anchoring a OneNote window to the side of your desktop. Your notes will stay on top of your desktop while you are working in other programs.

Dock to Desktop

Linked Note taking

 

OneNote Linked Note Talking

While you are using the Dock to Desktop mode you can enable Linked Note Taking. This will automatically create a link to the page or office document you have open while you have taken note. This is perfect, while I was write a whitepaper for university and I had to do a lot of research I used this feature. While I was write the document I had to mention the sources as foot notes and sometimes it’s hard to find the source of something you have found on the internet. With linked notes I only had to check my nodes and all the sources and references were linked.

 Visio Integration

OneNote Visio Integration

A lot of other Microsoft products to integrate into OneNote. One of them is Visio, if you have Visio installed on our computer you can add an existing Visio diagram to you notes. You can also directly create a new Visio diagram from OneNote and add it to your notes.

(more…)



Sort Network Adapter via PowerShell

Sort Windows Network Adapter by PCI Slot via PowerShell

If you work with Windows, Windows Server or Hyper-V you know that before Windows Server 2012 Windows named the network adapters randomly. This was a huge deal if you were trying to automate deployment of servers with multiple network adapters. And of course Hyper-V Servers normally have multiple network adapters. In Windows Server 2012 Microsoft had some different ways how this was fixed. First there is CDN (Consistent Device Naming) which allows hardware vendors to integrate the names so the OS can pick them up and the second one being the possibility of Hyper-V Converged Fabric which is basically making our lives easier by having less network adapters.

Well a lot of vendors have not integrated CDN or you have some old servers without CDN support. Back in May 2012 before the release of Windows Server 2012 I wrote a little Windows PowerShell script to sort network adapters in Windows Server 2008 R2 and Hyper-V Server 2008 R2 by using WMI (Configure Hyper-V Host Network Adapters Like A Boss). Now for a Cisco UCS project I rewrote some parts of the script to use Windows PowerShell in for Windows Server 2012, Windows Server 2012 R2 and Hyper-V.

First lets have a look how you can get the PCI slot information for network adapters, luckily there is now a PowerShell cmdlet for this.

Now lets see how you can sort network adapters via Windows PowerShell.

This will get you a output like this:

Sort Network Adapter via PowerShell

Lets do a little loop to automatically name them:

So this names all the network adapters to NIC1, NIC2, NIC3,…

So lets do a PowerShell function for this:

Now you can run this by using Sort-NetworkAdapter for exmaple:

or

You can also get this script from the Microsoft Technet Gallery or Script Center.



Import MSOnline PowerShell Module

Manage Windows Azure AD using Windows PowerShell

Well I am a huge fan of Microsoft Office 365 and we are not only using this in our company, I am also using Office 365 for my mothers restaurant. It helps us organzise stuff very easily and allows us to work from everywhere. Now the great thing about using Office 365 and Windows Azure Active Directory it that I can manage it with the same management tools I also use for my on-premise Active Directory. My favorit is of course Windows PowerShell.

To manage Windows Azure Active Directory with PowerShell, where also your Office 365 users are stored, you have to do some simple steps.

First make sure you have installed the .NET Framework 3.5 on your management machine.

Install Microsoft Online Services Sign-in Assistant: Install the appropriate version of the Microsoft Online Services Sign-in Assistant for your operating system from the Microsoft Download Center. Microsoft Online Services Sign-In Assistant for IT Professionals RTW.

Install Windows Azure AD Module for Windows PowerShell: Install the appropriate version of the Windows Azure AD Module for Windows PowerShell for your operating system from the Microsoft Download Center:

Import the MSOnline Windows PowerShell module

Import MSOnline PowerShell Module

Connect to your Windows Azure Active Directory Tenant or your Office 365 Tenant:

This will open a popup windows where you have to enter your credentials.

Now now you can start working with your Windows Azure Active Directory.

Connect Windows Azure AD via PowerShell



PowerShell Get-FileHash

PowerShell – Get File Hash

Two years ago I wrote a blog post how you can get the MD5 File Hash per Windows command line by downloading the File Checksum Integrity Verifier. With the latest release of PowerShell, PowerShell v4, Microsoft included a new cmdlet. Get-FileHash allows you to get file hashes and different algorithms.

Get-FileHash computes the hash value for a file by using a specified hash algorithm. A hash value is a unique
value that corresponds to the content of the file. Rather than identifying the contents of a file by its file
name, extension, or other designation, a hash assigns a unique value to the contents of a file. File names and
extensions can be changed without altering the content of the file, and without changing the hash value.
Similarly, the file’s content can be changed without changing the name or extension. However, changing even a
single character in the contents of a file changes the hash value of the file.

The purpose of hash values is to provide a cryptographically-secure way to verify that the contents of a file have
not been changed. While some hash algorithms, including MD5 and SHA1, are no longer considered secure against
attack, the goal of a secure hash algorithm is to render it impossible to change the contents of a file—either by
accident, or by malicious or unauthorized attempt—and maintain the same hash value. You can also use hash values
to determine if two different files have exactly the same content. If the hash values of two files are identical,
the contents of the files are also identical.

By default, the Get-FileHash cmdlet uses the SHA256 algorithm, although any hash algorithm that is supported by
the target operating system can be used.