Monthly Archives: March 2017

Script: Close form after certain time

I use this to create time-limited splash screens I then display during various other scripts I run to keep the end user informed. The beauty of this one is that is there is no DialogResult i.e OK, Yes or Cancel when the form is closed, therefore no annoying pop-up messages when the script is run in GUI-only mode (text corrected 09/05/17).
function Splash1 {
$form1 = New-Object ‘System.Windows.forms.form’
$label1 = New-Object ‘System.Windows.Forms.Label’
$timer1 = New-Object ‘System.Windows.Forms.Timer’
$InitialFormWindowState = New-Object ‘System.Windows.Forms.FormWindowState’
$form1_Load = {
$TotalTime = 5 #in seconds
$script:StartTime = (Get-Date).AddSeconds($TotalTime)
#Start the timer
#Use Get-Date for Time Accuracy
[TimeSpan]$span = $script:StartTime – (Get-Date)
#Update the display
if ($span.TotalSeconds -le 0) {
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
#Remove all event handlers from the controls
catch [Exception]
{ }
# form1
$form1.ControlBox = $false
$form1.StartPosition = “CenterScreen”
$form1.text = “BitLocker Installation”
$form1.Size = New-Object System.Drawing.Size(300,100)
$form1.Font = “Segoe UI,12”
$form1.Topmost = $True
$form1.ForeColor = [System.Drawing.Color]::White
$form1.BackColor = [System.Drawing.Color]::LightSteelBlue
# label1
$label1.Text = “Checking System…”
$label1.AutoSize = $True
$label1.Font = “Segoe UI,18”
$label1.Location = “42,15”
# timer1
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
#Clean up the control events
#Show the Form
return $form1.ShowDialog()
#display form
Splash1| Out-Null
PS – Not my own work, I amended a script I found on the web, I just can’t remember where I found it. If I find the link I’ll post it here. Credit where credit’s due after all…

ADMT Computer Migration Error: “Unable to determine which Domain the machine ‘computer-name’ belongs to”

The Scenario

I am attempting to migrate a computer account from domain “eng.domain1.test” to mynewdomain.test. There is a two-way forest trust between them. The two servers can ping each other using the FQDN.

The Problem

When I run the ADMT Computer migration wizard I search for and find the name of the computer I want to migrate (comp1.eng.domain1.test). However when  clicked next to proceed it returned the error:

“Unable to determine which Domain the machine ‘comp1’ belongs to”

I am blocked from proceeding with the migration.

The Solution

My issue was DNS related. The GPO applied to the ADMT server, which amongst other things defines the DNS suffix list in the advanced TCP-IP properties tab for the ADMT server’s Ethernet properties, did not include the domain eng.domain1.test.

Once I amended the GPO setting (Computer Configuration > Polices > Administrative Templates > Network > DNS Client > DNS Suffix search list) to include eng.domain1.test and this was applied to the server, I rebooted (it didn’t work until I did this) launched ADMT and this time it could determine the domain membership.


Disclaimer: provided “AS IS” with no warranties and confer no rights

Partition Assist Standard – “Bootmgr is missing Press Ctrl+Alt+Del to restart”

The Scenario

I have a PC running Windows 7, it has a 300GB C drive and a 100mb System Reserved partition. I need to increase the size of the 100mb System Reserved Partition to 600mb. I’m going to use Partition Assistant Standard Edition 6.1 to complete the following tasks:

  1. Shrink the C drive by 500mb – this will create a 500mb unallocated blob at the end of the C drive partition.
  2. Move the C drive so the unallocated 500mb is to the right of the System Reserved partition (you can only extend a partition if there is unallocated space directly next to it)
  3. Increase the System Reserved partition to 600mb.


The Problem

I completed steps 1 & 2, applied them and restarted the computer (as is required as I have virtual of moving the OS partition). Upon reboot the computer fails to boot (shifting the C drive has moved the files but the partition table doesn’t yet know this has happened and is still pointing to boot files that no longer exist where it thinks they do) and Partition Assistant does not run to complete the tasks. All I get is the following error instead:

“Bootmgr is missing Press Ctrl+Alt+Del to restart”

The Solution #1 (You have the Windows OS installation media)

  1. Insert the Windows OS installation media and reboot – you need this to get to the Repair option.
  2. RC0a
  3. The media will start the installation process (you’re not going to proceed with the install). Select the Language and Time/Currency format settings for your current installation. Click Next
  4. RC0b
  5. In the lower left corner click the Repair your computer option
  6. RC0c
  7. The System Recovery Options will launch
  8. RC1
  9. Assuming your OS has been listed click Next to proceed.IMPORTANT Note the Location description, this is important for Step 12 when using the Recovery Command Prompt as you need to switch to the drive that has the OS installed and the drive mappings are temporarily changed whilst in Recovery mode.
  10. In the next System Recovery Options screen select the Command Prompt option
  11. RC2
  12. The Recovery Command Prompt will open at the X drive. Change to the D drive (or whatever drive letter was stated in step 7.
  13. RC4
  14. Type bcdboot d:\windows /s c: and press enter.
  15. RC5
  16. Type exit to close the command prompt and press Restart to reboot.
  17. RC6
  18. At this point I rebooted my PC and Partition Assistant ran it’s pending tasks and rebooted the PC. The OS then loaded normally.

The Solution #2 – if you do not have the Windows OS Installation media

  1. Reboot your computer and press F8 repeatedly until the Advance Boot Options window opens.
  2. RC7
  3. Select the top option Repair Your Computer