Windows

Windows

Windows Server 2012 booting in recovery (GPT/UEFI FIX)

If OS keeps booting in recovery, this is how you can fix it:

Screen-Shot-2017-07-09-at-9.08.26-AM.png

Open the CMD in the windows live cd and start diskpart and list the disks that are available:

diskpart
list disk

Select the disk for the OS

sel disk 0

List the volumes inside that disk:

list vol

Select the partition in FAT as it is you EFI boot partition

sel vol 4

Assign a letter to the EFI partition so you can mount it

assign letter=G:

Exit diskpart

exit

cd in the EFI boot

cd /d G:\EFI\Microsoft\Boot\

run a bootrec

bootrec /FixBoot

rename the BCD inside the path G:\EFI\Microsoft\Boot\

ren BCD BCD.old

Recreate the BCD file using bcdboot

bcdboot c:\Windows /l en-us /s G: /f All

 You can also run a SFC scan as it might fix some errors

sfc /scannow /offbootdir=g:\ /offwindir=c:\windows

 Then exit reboot and check if the OS can boot 

A common error after reboot could be a system file is corrupted such as the error below:

Windows-7-registry-corrupt.png

To fix it boot back in the live CD and open a CMD and rename the system file as old:

cd /d C:\Windows\System32\config\
ren system system.old

The RegBack contains a working version of the system file so just copy it over.

copy C:\Windows\System32\config\RegBack\system C:\Windows\System32\config\

Then exit reboot and check if everything is working :)

IIS 7: Install a certificate

If you have 2 files, a key and a crt, you can use the following command in linux/osx or cygwin with openssl:

openssl pkcs12 -export -out ssl_cert.pfx -inkey priv_key.key -in the_crt_file.crt

 To Install an Intermediate Certificate in Microsoft IIS 7

  1. Click Start, and then click Run....
  2. Type mmc, and then click OK. The Microsoft Management Console (Console) window opens.
  3. In the Console1 window, click the File menu, and then select Add/Remove Snap-in.
  4. In the Add or Remove Snap-in window, select Certificates, and then click Add.
  5. In the Certificates snap-in window, select Computer Account, and then click Next.
  6. In the Select Computer window, select Local Computer, and then click Finish.
  7. In the Add or Remove Snap-in window, click OK.
  8. In the Console1 window, click + to expand the folder.
  9. Right-click Intermediate Certification Authorities, mouse-over All Tasks, and then click Import.
  10. In the Certificate Import Wizard window, click Next.
  11. Click Browse to find the intermediate certificate file.
  12. In the Open window, change the file extension filter to PKCS #7 Certificates (*.spc;*.p7b), select the *_iis_intermediates.p7b file, and then click Open.

    Do not install your Leaf Certificate in this area. Doing so removes your certificate from the list, and you must reinstall to correct the problem.

  13. In the Certificate Import Wizard window, click Next.
  14. Select Place all certificates in the following store, and then click Browse.
  15. In the Select Certificate Store window, select Intermediate Certification Authorities, and then click OK.
  16. In the Certificate Import Wizard window, click Next.
  17. Click Finish.
  18. Click OK.
  19. Close the Console 1 window, and then click No to remove the console settings.

To Install an SSL Certificate in Microsoft IIS 7

  1. Click Start, mouse-over Administrative Tools, and then click Internet Services Manager.
  2. In the Internet Information Services (IIS) Manager window, select your server.
  3. Scroll to the bottom, and then double-click Server Certificates.
  4. From the Actions panel on the right, click Complete Certificate Request....
  5. To locate your certificate file, click ....
  6. In the Open window, select *.* as your file name extension, select your certificate (it might be saved as a .txt, .cer, or .crt), and then click Open.
  7. In the Complete Certificate Request window, enter a Friendly name for the certificate file, and then click OK.

For Wildcard SSL certificates make sure your Friendly Name to matches your Common Name (i.e. *.coolexample.com).

  1. In the Internet Information Services (IIS) Manager window, select the name of the server where you installed the certificate.
  2. Click + beside Sites, select the site to secure with the SSL certificate.
  3. In the Actions panel on the right, click Bindings....
  4. Click Add....
  5. In the Add Site Binding window:
    • For Type, select https.
    • For IP address, select All Unassigned, or the IP address of the site.
    • For Port, type 443.
    • For SSL Certificate, select the SSL certificate you just installed, and then click OK.
  6. Close the Site Bindings window.
  7. Close the Internet Information Services (IIS) Manager window. Your SSL certificate installation is complete

 

Hyper-V

Hyper-V

S2D Force remove a drive

To verify that all drives are healthy and operational :

Get-PhysicalDisk

Get the FriendlyName of the device :

Get-PhysicalDisk | ft FriendlyName

Retire the disk :

Set-PhysicalDisk -FriendlyName "<DeviceName>" -Usage Retired

Find the name of the Virtual Disk :

Get-VirtualDisk

If the name is too long use :

Get-VirtualDisk | ft -AutoSize

For every Virtual Disk in the storage pool do :

Repair-VirtualDisk -FriendlyName "YourVirtualDisk"

Open a new PowerShell window to monitor the repairs with :

Get-StorageJob

Remove the PhysicalDisk if all repairs are successfully done:

Get-PhysicalDisk | Where-Object { $_.Usage -eq ‘Retired’}

Assign the disk to a variable:

$DiskToRemove = Get-PhysicalDisk | Where-Object { $_.Usage -eq ‘Retired’}

Find the name of the storage pool:

Get-StoragePool

Delete the physical disk from the storage pool:

Remove-PhysicalDisk -PhysicalDisks $DiskToRemove -StoragePoolFriendlyName "Storage pool"
Hyper-V

Add IP on vSwitch

So you installed hyper-v and you need to configure your NIC with your public IP and your secondary IP's, let me show you how.

(Would recommend having physical access / KVM IP if anything fails)

First create a v-Switch in the hyper-v settings.

Capture.PNG

Then, go to the IPv4 settings of your new hyper-v vswitch and add your primary IP.

Capture2.PNG

To add your secondary IP's, you will need to go the the advanced options and put in the first usable address of your secondary subnet, not the broadcast address but the first usable address and the subset below.

You will then use that address as the gateway for your VM's.