Happy Halloween

I have always mostly done basic natural light photography, never really busted out the flash. In my younger years, it seemed almost as if using a flash was somehow cheating. You’d see trendy blogs where everyone was shooting HDR, and seeking cameras with higher and higher ISO settings. Photo blogs would publish headlines like “If you want to learn to be a great Photographer, learn to use available light!” It never ended.

Then, I found a blog called “The Strobist”. There is a series of now legendary blog posts outlining using a basic flash setup to get very professional results. I would recommend the Lighting 101 series as a good starting point. There he outlines a very inexpensive flash setup to get started. So I got a little setup. A flash stand, wireless triggers, and an umbrella.

I have used this setup a few times now to take pictures of my daughter. The more time I spend with setting it up, the better it’s working out. Over the last weekend, we did some photos of our daughter, and our friend’s son. They came out really nice, and I’m certainly glad I invested in the flash setup.

Vacation. It's been awhile.

I went on vacation with the family down to Oak Island, NC. It's been a while since I took some time off. But I took some pictures. Here they are. I'm sure there are more. But this is a good start.

You have a CSV file that has data that needs to be added to Active Directory you say?

You aren't going to believe this, but today's your lucky day. Funnel that CSV file into this script, and you're on your way to happiness.

But seriously, this is something I assembled and cleaned up from the remnants of another script. Simple, easy to understand, and quick. I processed records for just over 300 users in 42 seconds. That'll do.

# Update AD User Data
# Source data in CSV format
# 2018 - Joel Spangler
# Bell and Evans

# Get script Start Time
$startTime = (Get-Date)

# set path to input file
$csvfile = "C:\scripts\ADImport\adexport.csv"

# Specify Domain
$ADServer = 'farmerspride.com'

# Import the AD Module
Import-Module ActiveDirectory

# Create Function to import data from CSV and perform corresponding AD Updates

Function Update-ADUsers {

    Import-Csv -path $csvfile | `
    ForEach-Object {
        # Each of the following corresponds to the Fields defined in the CSV file
        $DisplayName = $_.Name
        $Description = $_.Description
        $Department = $_.Department
        $Title = $_.'Job Title'
        $Office = $_.Office
        $Mobile = $_.'Mobile Phone Number'
        $Phone = $_.Telephone
        $sam = $_.Username
        $Address = $_.StreetAddress
        $State = $_.State
        $Company = $_.Company
        $Country = $_.Country
        $City = $_.City

        # Manager Field takes some extra work.
        $Manager = $_.Manager
        if ($Manager -ne $null){$Manager = Get-ADUser -Filter {Name -like $Manager} | select -Expand DistinguishedName}

        # Verify AD Account
        Try { $SAMinAD = Get-ADUser -server $ADServer -LDAPFilter "(sAMAccountName=$sam)"} 
        Catch { }

        # If statement - Valid If AD user exists
            If($SAMinAD -ne $null -and $sam -ne '') {

            # evaluate each field - if data us present - update corresponding field - match each field to ADSI attribute name
            If ($DisplayName -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{displayName=$DisplayName} }
            If ($DisplayName -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{cn=$DisplayName} }
            If ($Description -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{description=$Description} }
            If ($Department -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{department=$Department} }
            If ($Title -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{title=$Title} }
            If ($Manager -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{manager=$Manager} }
            If ($Office -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{physicalDeliveryOfficeName=$Office} }
            If ($Mobile -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{mobile=$Mobile} }
            If ($Phone -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{telephoneNumber=$Phone} }
            If ($Address -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{streetAddress=$Address} }
            If ($State -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{st=$State} }
            If ($Company -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{company=$Company} }
            If ($Country -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{co=$Country} }
            If ($City -ne '') { Set-ADUser -server $ADServer -Identity $sam -Replace @{l=$City} }


            Else { 
            #Error - AD User does not exist
            " User $sam not found in AD "


#End Function

#Run Function

# Set End Time
$endTime = (Get-Date)

# Calcualate total time to run. Unnecessary, but fun.
"Elapsed Time: $(($endTime-$startTime).totalseconds) seconds"
"Elapsed Time: $(($endTime-$startTime).totalminutes) minutes"

Did a Microsoft patch break Hyper-v For You? Me too! Luckily there's a fix.

A while back there was quite the buzz about the Meltdown/Spectre vulnerabilities related to x86 code on AMD and Intel processors. There were firmware updates, patches, and general hysteria for about a week. Well, as it turns out, windows server patch kb4056898 decided to break one of my hyper-v hosts. The patch prevented any VMs from starting. The only immediate fix was to remove the patch. 

Well, as it turns out, that patch got rolled into newer patches. Basically any Security rollup after January 2018 contains the patch. So removing the patch every month wasn't really an option. But without fail, the VMs on this isolated host would just go down every time the server was patched. Well, after much reading, and searching, it turns out that this security update had Registry Keys that had to be modified, manually.... Microsoft strikes again. 

Well, I finally stumbled upon a thread that covers the whole thing rather in depth:


And just in case anyone else has run into this buzzsaw, keep in mind this would also effect Docker as well, here are the steps to get things back to normal:

Do all of this from and elevated command prompt:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 3 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

Restart the server for the changes to take effect.

Enable the fix

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f

Restart the server for the changes to take effect.

And voila! Your VMs will start right up. Also keep in mind that I had the issue on Server 2016, while in the article, he has the issue on 2012 R2. So this isn't specific to the OS version it seems.

Pets on the porch

I recently snagged a new Canon 6D on the sale of the century, and have to say, it's a big improvement on my 10 year old 50D. Also, having a full frame sensor is a huge improvement to the APS-C sensor on the 50D. I've already taken a lot of pictures with it. And even a movie (something else the 50D couldn't do). Here are some pictures from the back porch today.