Archive for the ‘Microsoft’ Category

Recently I’ve updated my system to Windows 8.1 and next to 10 (viva NSA \o/). After I shutdown my lap’ and then start it again, it hangs, freezes, etc. There was a cool hing about this. When bought with pre-installed Windows 8 – there was one device that was already disabled… strange. It was storage SD/MCC controller. I’ve tested this and disabled device called “O2 MicroSD/MMC controller” – rebo0ted and… the freeze has gone. I’ve also tried to install older drivers – it also works.

O2 MicroSD/MMC controller

O2 MicroSD/MMC controller


Let’s take this scenario. You’ve uploaded a new version of software to the Server. You didn’t push the “Unblock” putton in file Properties… . The application upgraded itself, and for now you’ve a thousands of files in hundreds of folders which are “Blocked”, but can be readable… how can you repair this? With PowerShell 3!

dir c:\mydir -Recurse | Unblock-File


dir c:\mydir -Recurse | Unblock-File -WhatIf

Easy, huh?

You have more than 500-1000 users and need to change the UserPrincipalName?


Get-ADUser -Filter * -SearchBase $ou | ForEach-Object { $newUpn = $_.UserPrincipalName.Replace($old,$new) $_ | Set-ADUser -server $server -UserPrincipalName $newUpn }

Of course it is better to debug the command before running in production environment so place a “-WhatIf” mark after the command, like this:

Get-ADUser -Filter * -SearchBase $ou | ForEach-Object { $newUpn = $_.UserPrincipalName.Replace($old,$new) $_ | Set-ADUser -server $server -UserPrincipalName $newUpn -WhatIf }

Probably you have a new PC, and UEFI-model BIOS, so basically your PC has an USB Legacy support and USB3 also. Sooo, from Windows 7++ there’s no need to enable USB Legacy, so disable it, and with the other awesome UEFI features, disable like this:

Legacy USB – disabled
EHCI Pre-boot Driver – disabled
XHCI Pre-boot Driver – disabled
EHCI Hand-off – disabled
XHCI Hand-off – enabled


I was quite bit disturbed when the Offline NT Password Recovery didn’t work as it should. So I found another method of bypassing Windows 7 administrator account password. Of course there’s a need to have an installation CD and then from the CLI you just need to copy:

copy c:\windows\system32\sethc.exe c:\
copy c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe -f
shutdown -r

Now’s the funny part. After restart when you see Windows Logon screen press SHIFT x5 times and… viola you opened an admin CLI.


Now you can log in.

“Damn, I’m good” (c) Duke Nukem.

I think I’ve finally cleared the topic about recovering boot sector in Windows machines. I mean, there wasn’t any big mistake, but let get things clear – this is a co0l topic for IT helpdesk and to gain some money ’cause users cannot fix this by themselves. SO… with the Windows 8.* boot failures there’s one good method to rescue the environment. If you had read my post before, you can also try to do this:

Clear the RO if you cannot bootrec /rebuildbcd:

select disk {disk_number_here} 
attrib disk
attrib disk clear readonly

Clear the RO from volume also:

list vol
sel vol {vol_number_here}
attrib vol
attrib vol clear readonly 

And finally you can run:

chkdsk {sys_drive}: /r /x /f

Of course the error could be strongly related to Windows Registry, so basically a backup (if exist) can work!

cd windows\system32\config
ren default default.old
ren sam sam.old
ren security security.old
ren software software.old
ren system system.old
cd regback
copy default {sys_drive}:\windows\system32\config
copy sam {sys_drive}:\windows\system32\config
copy security {sys_drive}:\windows\system32\config
copy software {sys_drive}:\windows\system32\config
copy system {sys_drive}:\windows\system32\config


sfc /scannow /OFFBOOTDIR={sys_drive}:\ /OFFWINDIR={sys_drive}:\windows

{sys_drive} is usually c.

For error like 0x000000e or “can’t find hardware” try this combination in Windows 7/8/8.1:

bootrec /fixmbr
bootrec /fixboot
bootsect.exe /nt60 all /force
bootrec.exe /rebuildbcd

Also this could help:

bcdedit /export C:\BCD_Backup
cd boot
attrib bcd -s -h -r
ren c:\boot\bcd bcd.old
bootrec /RebuildBcd

But if not… here’s a heavy method:
Advanced DiskPart and Boot creation process (must have a free 100MB for a Windows System Reserved Partition):

list disk
select disk 0 #Choose your system disk
create partition efi size=100
list partition #Created partition must be selected
format quick fs=fat32 label="SysRec"
assign letter=X
create partition msr size=128
list partition #Check for errors
list vol
select vol 3 #Windows installation number should be used
assign letter=C

Copy the EFI:

mkdir X:\EFI\Microsoft\Boot
xcopy /s C:\Windows\Boot\EFI\*.* X:\EFI\Microsoft\Boot

Create the whole new BCD store:

cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD  /create {bootmgr} /d “Windows Boot Manager”
bcdedit /store BCD /create /d “Windows 8” /application osloader
#Show {guid} like {c0dfc4fa-cb21-11dc-1337-005056c00008}, replace below with {guid}
bcdedit /store BCD /set {bootmgr} default {guid}
bcdedit /store BCD /set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
bcdedit /store BCD /set {bootmgr} displayorder {default}
bcdedit /store BCD /set {default} device partition=c:
bcdedit /store BCD /set {default} osdevice partition=c:
bcdedit /store BCD /set {default} path \Windows\System32\winload.efi
bcdedit /store BCD /set {default} systemroot \Windows

To fix the UEFI use:

bcdboot c:\Windows /s X: /f ALL