Hyper-V Core (with powershell): Firewall management

Change Firewall Status

netsh advfirewall show private
netsh advfirewall show public
netsh advfirewall show domain

Disable Firewall

Set-NetFirewallProfile -Profile Domain -Enabled False
Set-NetFirewallProfile -Profile Public -Enabled False
Set-NetFirewallProfile -Profile Private -Enabled False

Hyper-V Core (with powershell): Task scheduling

Get Task List

Gets the task definition object of a scheduled task that is registered on the local computer.

Create a task:
schtasks /create /tn "WinBkp-Daily" /tr "powershell I:\Scipts\.\backup-HyperV.ps1" /sc daily /st 04:00 /ed 10/10/2016
schtasks /create /tn "ITMASTERBackupServer" /tr "powershell C:\Itmaster\.\backupHyper2.ps1" /sc daily /st 04:00 /ed 1/1/2020
Delete a task:
schTasks /Delete /TN “WinBkp-Daily”
Get Task Info
Get-ScheduledTaskInfo MyBackupJob
Start a Task
Start-ScheduledTask -TaskName "ScanSoftware"

Hyper-V Core (with powershell): Shares & Disk management

Mount Network Share

You can find the instructions here.

New-PSDrive -Name "P" -PSProvider "FileSystem" -Root "\\\Backup"
With Credentials
New-PSDrive -Name "P" -Credential edafo.local\itmaster -PSProvider 
"FileSystem" -Root "\\\Backup

With Credentials & Permanent
New-PSDrive -Name "P" -Persist -Credential edafo.local\itmaster 
-PSProvider "FileSystem" -Root "\\\Backup

Remove Network Share

Get-PSDrive X, S | Remove-PSDrive

List All Mapped Drives


Mount a VHDX file and access Virtual Machine disk

Mount-VHD <vhd path & filename>

Disk partitioning

List Disk

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B
Disk 1 Online 1862 GB 0 B
Disk 2 Online 1863 GB 18 MB *

select disk X
list partition
select partition Y
list volume
select volume Z
assign letter=D

Dismount a VHD disk

Dismount-VHD -DiskNumber 6