PowerShell Snippets: Write-Output

PowerShellThis post is part of the series on PowerShell Snippets.

The following PowerShell command will output the supplied message to the PowerShell console (replace the highlighted section with the message to output):

Write-Output {message]

PowerShell for Hyper-V: Resume VM

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

The following PowerShell command can be used to resume a suspended virtual machine (replace the highlighted section with the name of your virtual machine):

Resume-VM -Name {VM name}

PowerShell for Hyper-V: Suspend VM

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

The following PowerShell command can be used to suspend (pause) a virtual machine (replace the highlighted section with the name of your virtual machine):

Suspend-VM -Name {VM name}

PowerShell for Hyper-V: Save VM

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

The following PowerShell command can be used to save a virtual machine (replace the highlighted section with the name of your virtual machine):

Save-VM -Name {VM name}

PowerShell for Hyper-V: Shut Down VM

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

The following PowerShell command can be used to shut down a virtual machine (replace the highlighted section with the name of your virtual machine):

Stop-VM -Name {VM name}

PowerShell for Hyper-V: Start VM

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

The following PowerShell command can be used to start a virtual machine (replace the highlighted section with the name of your virtual machine):

Start-VM -Name {VM name}

PowerShell for Hyper-V: Avoid Error Running PowerShell Scripts

Hyper-VThis post is part of the series on PowerShell for Hyper-V.

If you try to run a PowerShell script, you will receive an error:

PowerShell error trying to run script

File C:TempResume HVVMs.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at 
https:/go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

This is deliberate on Microsoft’s part to make sure a script is not inadvertently run. You can enable running of scripts, but this is very risky.

However, there is a command you can run which will, for only the script being run, allow the script to run (replace the highlighted section with your script file):

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File {your script}

The relevant section is

-ExecutionPolicy Bypass

which tells PowerShell that it may bypass the execution policy restriction.

PowerShell for Hyper-V: Series Index

Hyper-VWhen I joined ISC Software Solutions I received a new work laptop. This gave me both the need and, importantly, the time to get everything setup as I need it. This included creating new demo VMs to use.

In the past, I had one VM for each version with everything installed. This time round I have created two VMs, one hosting a Domain Controller and the other a SQL Server, which I will then use with a version based server.

To make things a little easier, I have created some PowerShell scripts to handle the VMs. This is a short series of posts for the scripts I have (none of them are complex, but I’m posting them here for easy access.

Continue reading “PowerShell for Hyper-V: Series Index”

Hyper-V: ‘The requested operation could not be completed due to a file system limitation’

Hyper-VWhen I joined ISC Software I received a new laptop which was pretty much a blank slate except for Windows itself. This meant that I had to install and configure everything I needed (I prefer this as it means I can configure everything exactly as I want it).

Due to having an SSD, instead of an HDD, in the laptop, I also got an external SSD which I am using for hosting my virtual machines using Hyper-V.

I thought nothing of this, but when I tried to start a VM from the external SSD, I received the following error:

Hyper-V Manager error

...Failed to power on with the Error 'The requested operation could not be completed due to a file system limitation'.

I double checked the external SSD and discovered it had a File System of exFAT; I reformatted the SSD into NTFS copied the virtual hard disks back onto it and was able to successfully start the virtual machine.

Errors Starting Local by Flywheel

Local By FlywheelI fired up Local by Flywheel again recently to test some changes to a plugin; as it started I received a series of errors:

Error message

Error
Uh-oh! We ran into a hiccup when trying to start the Local Machine.
Unable to start the VM: C:Program FilesOracleVirtualBoxVBoxManage.exe startvm local-by-flywheel --type headless failed:

Continue reading “Errors Starting Local by Flywheel”