• Thawte: The state name can not be abbreviated. Gets me every time.

    Note to self: When generating a CSR for Thawte: The State Name in the CSR cannot be abbreviated

    Gets me every time.


  • BASH script to change the Security Keys and SALTs in a wp-config.php file

    I wanted to automatically change the Security Keys/SALTS when provisioning a new WordPress site. WordPress.com has a service that spits back random values. (https://api.wordpress.org/secret-key/1.1/salt/). The script below CURLs the values and then modifies a wp-config.php file with the new random values.

    SALTS=$(curl -s https://api.wordpress.org/secret-key/1.1/salt/)
    while read -r SALT; do
    SEARCH="define('$(echo "$SALT" | cut -d "'" -f 2)"
    REPLACE=$(echo "$SALT" | cut -d "'" -f 4)
    echo "... $SEARCH ... $SEARCH ..."
    sed -i "/^$SEARCH/s/put your unique phrase here/$(echo $REPLACE | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/" /Path/To/Your/wp-config.php
    done <<< "$SALTS"
    

    Don’t remember where I got the pieces of this, but here it is, I have been using it for a while and it seems to work well.
    Hope that helps someone.


  • Windows 10 PinToTaskbar does not work

    More Windows 10 fun. Trying to get a nice customized image for deployment. In the past I have used the verb “taskbarpin” and a RunOnce script to put icons on the users Task Bar.
    For example:

    $ShellApplication = New-Object -ComObject Shell.Application
    $result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft Outlook 2010.lnk").InvokeVerb("taskbarpin")
    $result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft Word 2010.lnk").InvokeVerb("taskbarpin")
    $result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft Excel 2010.lnk").InvokeVerb("taskbarpin")
    $result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft PowerPoint 2010.lnk").InvokeVerb("taskbarpin")
    

    Well, with the current build/set of patches, it no longer works. That was a waste of a day!

    Here is the bug filed with Microsoft Connect:

    Pint To Taskbar no longer working

    Hope that helps someone.


  • Windows 10 ignores Internet Explorer when using Import-Startlayout

    More Windows 10 inconsistencies. Clearly, I have Internet Explorer in my start screen layout xml (Line 10):

    <LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
      <DefaultLayoutOverride>
        <StartLayoutCollection>
          <defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
            <start:Group Name="Office" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
              <start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Microsoft Office\Office14\OUTLOOK.EXE" />
              <start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Microsoft Office\Office14\EXCEL.EXE" />
              <start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Microsoft Office\Office14\POWERPNT.EXE" />
              <start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Microsoft Office\Office14\WINWORD.EXE" />
              <start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Microsoft.InternetExplorer.Default" />
            </start:Group>
            <start:Group Name="Play and explore" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
              <start:Tile Size="4x2" Column="0" Row="0" AppUserModelID="Microsoft.BingFinance_8wekyb3d8bbwe!AppexFinance" />
              <start:Tile Size="4x2" Column="0" Row="2" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
              <start:Tile Size="2x2" Column="4" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
              <start:Tile Size="2x2" Column="4" Row="2" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
            </start:Group>
          </defaultlayout:StartLayout>
        </StartLayoutCollection>
      </DefaultLayoutOverride>
    </LayoutModificationTemplate>
    

    And when I log in for the first time, I.E. isn’t in the start menu.
    Others are having this issue too!


  • Using PowerShell to unpin the AppStore in Windows 10 – Workaround

    I can’t find a way to unpin the AppStore in Windows 10. So I wen’t about it another way.
    I reset the taskbar to have nothing and then I added everything back that I wanted.
    I am using this in my OSD/RunOnce PowerShell script to customize the user’s desktop.

    First of all I am using this function to manipulate the registry:

    Function ChangeRegistry{
    PARAM(
    $ErrorActionPreference = "SilentlyContinue",
    [Parameter(Mandatory=$true)]$registryPath,
    [Parameter(Mandatory=$true)]$Name,
    [Parameter(Mandatory=$true)]$Value ,
    [Parameter(Mandatory=$true)]$PropertyType,
    $Comment
    )
    Try {
     $RESULT=Get-ItemProperty -Path $registryPath -Name $Name | Out-Null
     New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null
    }
    Catch [System.Management.Automation.PSArgumentException] {
      New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null 
    }
    Catch [System.Management.Automation.ItemNotFoundException] {
      New-Item -Path $registryPath -Force | Out-Null
      New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null 
    }
    Finally { 
    $ErrorActionPreference = "Continue" 
    Write-host "$($Comment)$($Name): $Value"
    }
    }
    

    Next I reset the Taskbar:

    Write-Host "Setting up Start Menu" -ForegroundColor Green
    ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "Favorites" -PropertyType "Binary" -Value ([byte[]](0xFF))
    ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesResolve" -PropertyType "Binary" -Value ([byte[]](0xFF))
    ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesChanges" -PropertyType "DWORD" -Value 0
    ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesVersion" -PropertyType "DWORD" -Value 1
    Stop-Process -Name explorer -ErrorAction SilentlyContinue
    

    Finally I use the InvokeVerb method to put back what I want:

    $ShellApplication = New-Object -ComObject Shell.Application
    $result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft Outlook 2010.lnk").InvokeVerb("taskbarpin")
    

  • SCCM 2012 OSD task sequence, windows 10 drivers missing

    Still having problems getting my Windows 10 OSD up and running. Working with a Dell Latitude E7450 and the updated SCCM driver pack, but the drivers weren’t being installed.

    Ends up that you have to update your WINPE version from 8.1 to windows 10.
    Here is the article that I followed to update the WINPE version on SCCM 2012


  • Re-imaging a machine, with SCCM 2012 fails with error 0x80070570

    I have been working on building a new Windows 10 image. I was testing on a laptop and all of the sudden the OSD Task Sequence started failing, before anything even started!
    I had only made a minor change to the TaskSequence, so I was pulling my hair out.

    Error 0x80070570. 
    Logs shows : threadtoresolveandexecutetasksequence failed 0x80070570.
    

    If you are impatient like me, then you you power off the machine (press and hold the power button), and start over.
    Well, that was the issue. Drive was marked as dirty (so many power offs throughout the day!) and a check disk needed to be run.

    Hope that helps someone.


  • A better jQuery selector to hide a row in a SharePoint 2010 Edit Form

    In the past, I had used this code to hide a row in a SharePoint Edit Form (EditForm.aspx):

    $('nobr:contains("Attendees")').closest('tr').hide();
    

    The problem with this is that if you have two fields that contain the text “Attendees” (For example “NewAttendees” & “OldAttendees”), then it matches both of them (this always seems to to be an issue for us). So I did a little research and I found a better way to select a row (I think this was my original source)

    Here is my new/better way to match a row:

     $('nobr').filter(function () { return $(this).text() === 'Attendees' }).closest('tr').hide();
    

    If it was a required field, it would be:

     $('nobr').filter(function () { return $(this).text() === 'Attendees *' }).closest('tr').hide();
    

    Hope that helps someone.