Quick post: IIS drive

  • Context:

I installed recently a SAC (Semi Annual Channel) based Windows Server and I wanted to use some IIS cmdlets to configure it.

  • Problem:

The IIS: drive didn’t mount

  • Solution:

It appears that there are actually 2 modules.

One that doesn’t mount the IIS drive: the IISAdministration module

One that does: the WebAdministration module

What’s the difference between these 2 modules?

The IISAdministration module is more recent and compatible with both Windows PowerShell and PowerShell (Core).

Quick post: DISM and Features on Demand (FOD)

  • Context:

I started to migrate to the 1809 Windows 10 branch and Remote Server Administration Tools (RSAT) are no longer provided as a separate patch (MSU/cab file) but as a Feature on Demand.

  • Problem:

I wanted to avoid computers downloading the package from Windows Update or the default location set by Group Policy or the Windows directory of a mounted image or a running Windows installation that is shared on the network.

  • Solution:

I downloaded the FOD ISO image and extracted just the cab files I needed.

With the following structure (yes, you need the metadata subfolder and its content + meet the package dependencies)

you can use the Add-WindowsCapability cmdlet and do:

$Source = '\\server-share\whereIextractedCabfiles'
$HT = @{
 Name ='Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0'
 Online = [switch]::Present
 LimitAccess = [switch]::Present
}
Add-WindowsCapability @HT -Source:"$($Source)"

Quick post: Windows branch downgrade

  • Context:

We started testing the Windows 10 1809 on different hardware and we noticed some issues. Explorer keeps crashing and we decided to rollback.

  • Problem:

After the upgrade a new account logged on the computer.
DISM.exe /Online /Initiate-OSUninstall now refuses to run and says:

Error: 0xc16a0102
The OS uninstall cannot be initiated. User profiles were added.

  • Solution:

Identify the offending profile by opening the dism log file

Delete the offending profile

$UserProfiles = Get-WmiObject -Class Win32_UserProfile
# View it
$u = $UserProfiles | ? LocalPath -match 'myOffendingUserName'
$u
# Delete user folder
Get-Item "$($u.LocalPath)" | 
Remove-Item -Force -Recurse -Confirm:$false
# Delete user profile reference
$u.Delete()

Rollback to 1803 is now successful using dism.exe 😎

Decipher a message

As part of the PowerShell Summit, there’s a scripting competition also known as the “iron scripter” contest.

This year, one of the challenges was published on this page https://ironscripter.us/a-challenge-from-the-dark-faction/

There’s a message encoded with the Caesar Cipher on this page: http://bit.ly/DarkFactionMessage which leads to this text file



You can find more details on the Caesar Cipher on this wikipedia page.

About my solution: It’s clear that % is the space character. I needed to know if a character is upper or lower case and I did a substitution to the left in the ascii table by 5 or 37. Plus in some cases, I had to adjust the character without using a substitution (or I just simply failed to find the common denominator)

My quick and dirty solution is the following:

Function Test-CharisLowerCaseAlphabet {
Param($in)
([int]([char]$in)) -in 97..(97+25)
}
Function Test-CharisUpperCaseAlphabet {
Param($in)
([int]([char]$in)) -in 65..(65+25)
}
-join (
@'
Rtsfi%nx%ymj%sj}y%ljsjwfynts%uqfyktwr%ktw%firnsnxywfyn{j%fzytrfynts3%%Rtsfi%xtq{jx%ywfinyntsfq%rfsfljrjsy%uwtgqjrx%g~%qj{jwflnsl%ymj%3Sjy%Uqfyktwr3%%Kwtr%tzw%uwtyty~uj%-ymtzlm%qnrnyji.1%|j%hfs%uwtojhy%xnlsnknhfsy%gjsjknyx%yt%ij{jqtujwx1%yjxyjwx1%ut|jw%zxjwx1%fsi%firnsnxywfytwx3%Rtsfi%qj{jwfljx%ymj%3SJY%Htrrts%Wzsynrj%yt%uwt{nij%f%ut|jwkzq1%htsxnxyjsy1%nsyznyn{j1%j}yjsxngqj%fsi%zxjkzq%xjy%tk%yttqx%ymfy%iwn{j%it|s%htxyx%tk%firnsnxywfynts%fsi%rfpj%ymj%qnkj%tk%sts2uwtlwfrrjwx%f%qty%jfxnjw3%%
Rtsfi%htsxnxyx%tk?
63%Rtsfi%Fzytrfynts%Rtijq%-RFR.?%%Fs%fzytrfynts%rtijq%gfxji%zuts%3Sjy%hqfxxjx1%rjymtix%fsi%fyywngzyjx%yt%uwtizhj%Hriqjyx3
73%Rtsfi%Xmjqq%-RXM.?%%F%3Sjy%gfxji%xhwnuy%j}jhzynts%js{nwtsrjsy%ktw%j}utxnsl%Hriqjyx%fx%FUNx%htrrfsi%qnsj%yttqx%fsi%nsyjwfhyn{j%uwtlwfrrfgqj%htrrfsi%qnsj%xmjqq3
83%Rtsfi%Rfsfljrjsy%Rtijqx%-RRR.?%%Ymj%xjy%rfsflji%htij%gfxj%hqfxxjx%-tw%nsyjwkfhjx.%yt%nruqjrjsy%xujhnknh%rfsfljrjsy%xhjsfwntx%fsi%ns2ymj2gt}%firnsnxywfyn{j%yttqx%yt%j}jhzyj%ymtxj%xhjsfwntx3
93%Rtsfi%Wjrtyj%Xhwnuynsl%-RWX.?%%F%xjy%tk%\jg%Xjw{nhj%gfxji%htrutsjsyx%ymfy%fqqt|%xhwnuyx%yt%gj%wjrtyjq~%j}jhzyji%ts%rfs~%rfhmnsjx3
:3%Rtsfi%Rfsfljrjsy%Htsxtqj%-RRH.3%%F%3Sjy%gfxji%rtijq%fsi%xjy%tk%xjw{nhjx%ktw%gznqinsl%rfsfljrjsy%LZNx%ts%ytu%tk%RXM%fsi%j}utxnsl%fqq%LZN%nsyjwfhyntsx%fx%zxjw2{nxngqj%xhwnuyx3
'@.ToCharArray() | Foreach-Object {
$c = $_
Switch ($c) {
'%' { ' ' ; break}
'1' { ',' ; break }
'2' { '-' ; break }
'3' { '.' ; break }
'6' { '1' ; break }
'7' { '2' ; break }
'8' { '3' ; break }
'9' { '4' ; break }
'\' { 'w' ; break }
':' { '5' ; break }
'?' { ':' ; break }
'-' { '(' ; break }
'.' { ')' ; break }
'{' { 'v' ; break }
'}' { 'x' ; break }
'~' { 'y' ; break }
'|' { 'w' ; break }
"`r" { "`r" ; break }
"`n" { "`n" ; break }
{Test-CharisUpperCaseAlphabet -in $c} { [char](([int][char]$c) - 5) ; break }
{Test-CharisLowerCaseAlphabet -in $c} { ( [string][char](([int][char]$c) - 37)).ToLower(); break }
default {
'ZZZZZ'
Write-Verbose -Message "missing char -$($c)-" -Verbose
Write-Verbose -Message "missing -$([char](([int][char]$c) - 37))-" -Verbose
}
}
}
)

It looks like this:

The original text can be found on this page: https://devops-collective-inc.gitbook.io/the-monad-manifesto-annotated/what-is-monad