SQL Code for SCCM Status Message Viewer

December 15, 2015

FoxDeploy.com

I found myself juggling many different Status Message views in SCCM to try to keep on top of various messages that would arise in one environment.  So I did what anyone would do, and through liberal code-reuse and copy pasting, I reinvented the wheel.

What I’ve created here is based off of two built-in SCCM reports.  The first, Component Messages for the Last 12 Hours, and Count Errors for the last 12 hours (should be reports 80 and 89).

The output is a three-drill down view as seen here.

1 The first page is a collection of a count of messages separates by Warnings and Errors, and then a listing of each grouped by Component ID.

2 Clicking the link icon takes you to a listing of the warnings and errors for that site. I tried to transpose the actual message into the fields, but ran into a number of road blocks…

View original post 39 more words


DeployImage Module for PowerShell 5

December 15, 2015

Energized About PowerShell

This is a module I started to put together after the current MVP Summit when I decided I wanted to put together Nano Server.

The current Technet documentation at the time was lacking (it has dramatically improved) but this did not stop my internal need, A different way to deploy using only PowerShell

If you’re curious, you can download the module here on Github or here on the Technet Script Repository. Using PowerShell 5 you can follow the on screen prompts and use the following one liner.

Find-Module DeployImage | Install-Module

What does this module give you?

PowerShell Cmdlets to try and ease dropping a WIM file to a hard drive. It is NOT an MDT replacement. It is just an alternative option for the WIM deployment. The initial intention was just Nano Server but since the process applies to all WIM files you can use it however you…

View original post 527 more words


Getting Accurate File Versions

November 17, 2015

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 post 743 more words


Creating DNS records

November 5, 2015

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 {
[CmdletBinding()]
param (
[string]$name,
[string]$ipaddress,
[string]$zone = ‘Manticore.org’
)

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

$octs…

View original post 24 more words


Blocking Mixed Exchange 2013/2016 DAG

October 13, 2015

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 post 263 more words


Working with EPPlus and PowerShell

July 15, 2015

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 post 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 –

Get-CSUser TBOLTON

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 : BigDog.ad

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 {
param(
[parameter(Mandatory = $true)]
[String] $UID)
$User=(Get-ADUser $UID -Properties *)
$UserSAM=$User.SamAccountName
$UserName=$User.Name
$UserCN=$User.CN
$UserNickName=$User.MailNickName
# Report if there are differences
if (($UserSAM -eq $UserName) -and ($UserName -eq $UserNickName))
{
"`r`n"
Write-Host -foregroundcolor Green "The UserId"  $UID  "WAS a match"
"`r`n"
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
"`r`n"
} else {
"`r`n"
     Write-Host -foregroundcolor Red "The UserId"  $UID  "did NOT match"
"`r`n"
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
"`r`n"
    }
}

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

Follow

Get every new post delivered to your Inbox.

Join 551 other followers