Category Archives: Powershell

PowerShell in Azure Cloud Shell

if you are an Azure user see this post from the PowerShell team – https://blogs.msdn.microsoft.com/powershell/2017/05/23/coming-soon-powershell-in-azure-cloud-shell/

Posted in Powershell, Azure | Leave a comment

Diskpart and PowerShell – part4: Remove a partition

So far you’ve seen how to create and modify partitions and volumes. Its now time to look at how you remove a partition. Mount the test VHD Get-VHD -Path C:\test\Test1.vhdx | Mount-VHD You can’t remove a volume – you have … Continue reading

Posted in Powershell, Storage | Leave a comment

Diskpart and PowerShell–part 4: Expand a volume

Let’s create a new disk and mount it New-VHD -Path C:\test\Test1.vhdx -Dynamic -SizeBytes 20GB Get-VHD -Path C:\test\Test1.vhdx | Mount-VHD Initialize-Disk -Number 1 This time we’ll create a volume that only uses part of the disk New-Partition -DiskNumber 1 -DriveLetter F … Continue reading

Posted in Powershell, Storage | Leave a comment

Table or List

A question on the forum asked why a object is displayed in a table if it has 4 or fewer properties and as  a list if it  has more than 4 properties: PS> [PSCustomObject]@{P1=1; P2=2; P3=3; P4=4} P1 P2 P3 … Continue reading

Posted in Powershell | Leave a comment

Positional parameters

Positional parameters have been around since the beginning of PowerShell. Positional parameters assume the parameter you mean from the position of the value in the command you supply. For instance you can do this: Get-ChildItem -Path C:\test\ -Filter *.xml Path … Continue reading

Posted in Powershell | Leave a comment

ISE or VS code?

When PowerShell v2 shipped with the ISE it was seen as a great step forward. We now had a decent editor for creating PowerShell code and running that code. You could also invoke the debugger. Some extensions to ISE have … Continue reading

Posted in Powershell | 3 Comments

Mass dismount VHDs

I’m going to be creating, using and discarding a number of VHDs for my diskpart and PowerShell series. When I have a number of them mounted I want a quick way to dismount them. Assuming I consistently keep them in … Continue reading

Posted in Powershell, Storage | Leave a comment