Skip to content

Instantly share code, notes, and snippets.

Fill the free space of the disk with zeros

cat /dev/zero > zero.fill; sync; sleep 1; sync; rm -f zero.fill

Get a list of HDDs and the UUID of the virtual disk

VBoxManage.exe list hdds
VBoxManage.exe showhdinfo <disk>.vmdk

Convert to .VDI

@moddingg33k
moddingg33k / macos-installer-to-iso.sh
Created September 20, 2020 19:46 — forked from esutton/macos-installer-to-iso.sh
Create macOS Catalina Bootable ISO Image
#!/bin/sh
#
# File: macos-installer-to-iso.sh
#
# Create a bootable ISO image from a macOS installer to install VMware ESXi guests.
#
# https://gist.github.com/Kutkovsky/613e29f35d3ef420b23b59ecdf7a28e0
# Debug on: set -x
set -eux

Common Commands

VBoxManage.exe setextradata "VM Name" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" 
VBoxManage.exe setextradata "VM Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1"
VBoxManage.exe setextradata "VM Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" 
VBoxManage.exe setextradata "VM Name" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" 
VBoxManage.exe setextradata "VM Name" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Change Resolution

VBoxManage.exe setextradata "VM Name" "VBoxInternal2/EfiGraphicsResolution" 1600*900

Open terminal

sudo nvram recovery-boot-mode=unused
sudo shutdown -r now

Once in recovery mode run following commands in Utilities > Terminal

csrutil disable
nvram -d recovery-boot-mode

shutdown -r now

function Get-InstalledSoftware
{
<#
.SYNOPSIS
Reads installed software from registry
.PARAMETER DisplayName
Name or part of name of the software you are looking for
.EXAMPLE
$result = Get-CimInstance –ClassName Win32_DeviceGuard –Namespace root\Microsoft\Windows\DeviceGuard
Write-Host
Write-Host "Security Properties"
Write-Host "-------------------"
if ( $result.RequiredSecurityProperties -contains 1 ) {
if ( $result.AvailableSecurityProperties -contains 1 ) {
Write-Host "`tHypervisor support is required and available." -ForegroundColor Green
}
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
public static class Win32Api
{
[System.Runtime.InteropServices.DllImportAttribute( "User32.dll", EntryPoint = "GetWindowThreadProcessId" )]
public static extern int GetWindowThreadProcessId ( [System.Runtime.InteropServices.InAttribute()] System.IntPtr hWnd, out int lpdwProcessId );
[DllImport("User32.dll", CharSet = CharSet.Auto)]
@moddingg33k
moddingg33k / New-PSDrive.ps1
Last active August 16, 2020 19:08
Methods to mount a SMB share by PowerShell
$PsDriveParams = @{
Name = 'Z';
Root = '\\<fqdn>\<path>';
Credential = (Get-Credential)
}
New-PSDrive @PsDriveParams -PSProvider FileSystem -Scope Global -Persist
Param(
[switch] $RebootAfterInstall
)
# Default Variables
# -----------------
$PSDefaultParameterValues = @{
"Out-File:Encoding" = 'utf8';
};
@moddingg33k
moddingg33k / Windows 10 21H1.ps1
Created August 12, 2020 17:22
Test script Windows 10 21H1 2104. Save file in UTF-8 with BOM encoding
<#
.SYNOPSIS
"Windows 10 Setup Script" is a set of tweaks for OS fine-tuning and automating the routine tasks
Version: v4.5.8
Date: 12.08.2020
Copyright (c) 2020 farag & oZ-Zo
Thanks to all http://forum.ru-board.com members involved