Getting Accurate File Versions

November 17, 2015

Originally posted on Rohn's Blog:

I used to think that getting a file version in PowerShell was a fairly simple process:

PS> (Get-Item c:windowssystem32mshtml.dll).VersionInfo.FileVersion
11.00.9600.16410 (winblue_gdr.130923-1706)

There are two issues with that method, though:
1. That property can contain text along with the version
2. It turns out that in Windows Vista and higher, that property might not be coming from the file you think it is.

Issue #1 just means that the property is only good if you’re visually checking the version, or if no comparisons with other versions are necessary.

Issue #2 is the big one for me. What appears to be going on is that the FileVersion string is considered a non-fixed part of the version information, and it is pulled from the MUI resource file (if one exists). This file contains the language specific settings, and it looks like it only gets updated when the major or minor file version of…

View original 743 more words

Creating DNS records

November 5, 2015

Originally posted on Richard Siddaway's Blog:

Following on from my previous post about creating a reverse lookup zone in DNS here’s a function to create records in that zone.

The function takes an IP address and name (of host) and uses Add-DnsServerResourceRecordA to add the record to the forward lookup zone – I use my default AD zone.

The function then splits the IP address. Uses the last octet for the name in the reverse record. Creates the reverse lookup zone from the first 3 octets – notice how the range parameter is used in a decreasing way to specify the order of the octets – to create the reverse lookup zone. The host name and zone are used to create the FQDN of the host.

Add-DnsServerResourceRecordPtr is used to create the reverse (PTR) record.

function new-dnsrecord {
param (
[string]$zone = ‘’

Add-DnsServerResourceRecordA -Name $name -ZoneName $zone -AllowUpdateAny -IPv4Address $ipaddress


View original 24 more words

Blocking Mixed Exchange 2013/2016 DAG

October 13, 2015

Originally posted on EighTwOne (821):

Ex2013 LogoIn the RTM version of Exchange 2016, there’s an issue in that it is allows you to add Exchange 2016 Mailbox servers to Exchange 2013 Database Availability Groups, and vice-versa. As stated in the Release Notes (you do read those?), creating such a mixed version DAG is not supported. In theory, you could even jeopardize your Exchange data, as database structures from both versions are different. This action is also not prevented from the Exchange Admin Center, requiring organizations to have very strict procedures and knowledgeable Exchange administrators.

If you are worried about this situation and you want to prevent accidently adding Mailbox servers to an existing DAG consisting of members of a different Exchange version, there is a way (until this is blocked by the product itself, of course). Cmdlet Extension Agents to the rescue!

The Scripting Agent not only allows you to add additional instructions to existing Exchange…

View original 263 more words

Working with EPPlus and PowerShell

July 15, 2015

Originally posted on SqlChow:

I recently worked on a requirement, where the end user wanted to convert Excel files into tab-delimited text files. In my head I was like, this is easy: “PowerShell FTW! Yay!”. The reason for the excitement was because we already have two repositories that I know work well with Excel and fit my requirement.

When I started writing the solution, I used Doug’s module because it is as easy as it can get, I was able to write and “test” the code in under 30 minutes. Basically, all I had to do was:

  • Import the module
  • Call ‘ConvertFrom-ExcelSheet’ with the proper parameters

Viola! you can now convert Excel Workbooks with multiple sheets in them.

As much as I hate reinventing the wheel, customers sometimes want you to do stuff that simply does not make any sense. So, I had…

View original 212 more words

Check UserID for Differences

January 4, 2013

What prompted me to look for this solution was an error we received while trying to run –


I received this error –

Management object not found for identity "tbolton".
+ CategoryInfo : InvalidData: (tbolton:UserIdParameter) [Get-CsUser], ManagementException
+ FullyQualifiedErrorId : Identity,Microsoft.Rtc.Management.AD.Cmdlets.GetOcsUserCmdlet
+ PSComputerName :

The issue turned out to be the Alias Setting on the General Page in Exchange.  For what ever reason the entry there was BOLTONTIM

Today I found what Get-CSUser was keying off of in AD, it was keying off of, “MailNickName”.

# Used To Check for any differences in a UserID

# Example - PS C:\>Check-UserID TBOLTON

Function Check-UserID {
[parameter(Mandatory = $true)]
[String] $UID)
$User=(Get-ADUser $UID -Properties *)
# Report if there are differences
if (($UserSAM -eq $UserName) -and ($UserName -eq $UserNickName))
Write-Host -foregroundcolor Green "The UserId"  $UID  "WAS a match"
Write-Host -foregroundcolor Green "SAM Account:  " $UserSAM
Write-Host -foregroundcolor Green "User Name: -- " $UserName
Write-Host -foregroundcolor Green "CN: --------- " $UserCN
Write-Host -foregroundcolor Green "Mail ALias: - " $UserNickName
} else {
     Write-Host -foregroundcolor Red "The UserId"  $UID  "did NOT match"
Write-Host -foregroundcolor Red "SAM Account:  " $UserSAM
Write-Host -foregroundcolor Red "User Name: -- " $UserName
Write-Host -foregroundcolor Red "CN: --------- " $UserCN
Write-Host -foregroundcolor Red "Mail ALias: - " $UserNickName

In this example my account is intentionally set up wrong while the first account is set up correctly.

Why Should I Learn PowerShell? Real World Example Saves the Day!

January 30, 2012

Posted on the Hey Scripting Guy BLOG.  Why Should I Learn PowerShell? Real World Example Saves the Day!  Some real life issues that came up.

I was very happy to have been asked to contribute.

Click On Link Below

Why Should I Learn PowerShell? Real World Example Saves the Day!

Enforce Plain Text Outlook 2010

January 10, 2012

There are many companies, both large and small, that would like to require their users to use Plain Text only in their Outlook 2010 Emails.  If you have attempted this you have more than likely set up the appropriate settings available in Group Policy shown below.

I even went as far to ensure this setting on the Exchange 2010 Server Side via Powershell.
Where * is the Default Domain.

Set-RemoteDomain -Identity:* -ContentType MimeText
Get-RemoteDomain -Identity:* | fl - will show the settings.

After finding that the users were still able to select Format Text and change their text to both Rich Text and HTML I decided I had to dig deeper.

I found that I could manually change this feature while logging in with my account but this only affected my logon experience, not the other users.

With the New Message open click  File – Options

Click on Mail – Editor Options

Click on Customize Ribbon – Main Tabs from the drop down – Format Text – Format
Now you can remove Format and those options will no longer appear.

Notice that the Rich Text and HTML options are now gone and the default is Plain Text.

The next step was to reverse the settings placing the Format Text option back in place. Then I made a backup of the entire registry called B4.REG. I then made the changes listed above and once the settings were in place, I created another backup of the registry called Aftr.REG.
My plan was to use WINMerge to find where they change had occurred in the registry to help me find the control ID for the item that I wanted to disable via Group Policy shown below.

As you can see all I need is the Command Bar ID and I will be able to block it. There is even a link listed

Thank You Microsoft!

But as you see this link offers no help whatso ever…  Thanks Microsoft… sigh

Working with the two REG files B4.REG and Aftr.REG showed me nothing of any use. I was not able to find a change in the registry that would show me the needed Command Bar ID’s. I also used Process Explorer and Process Monitor, but again nothing that indicated where this was located in the registry where I could manually change a setting.
After endless Google links that provided endless bad information, I came across a link for this app.

Built-in Control Scanner
You use Built-in Controls Scanner to find command bar names and built-in controls IDs.

I installed this on one of my test machines and opened Outlook 2010 and started a new message then selected the Format Text tab.

I then stated the App with Outlook selected.


In Group Police I updated  –  User Configuration\Administrative Templates\Microsoft Outlook 2010\Disable Items in User Interface\Custom  I entered the Command Bar ID’s along with a description.

Enter the Command Bar ID’s here.  5564 and 5565

I ran Gpupdate /Force on the test machine and reopened Outlook 2010 and started a new email message.  As you can see, the Rich Text and HTML Text options are gone.  This will ensure that they users cannot use this option to bypass policy.

I hope this helps someone that has been trying to configure this setting.  If there is an easier way to do this please post the link here.


Get every new post delivered to your Inbox.

Join 528 other followers