Archive

Posts Tagged ‘Powershell’

Docker for Windows start-up error

September 25th, 2016 1 comment

After installing Docker for Windows I was unable to run it, following error appeared.

elmore_blog_docker_windows_powershell01

Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The specified module 'Hyper-V' was not loaded because no valid module file was found in any module directory.
at <ScriptBlock>, <No file>: line 76
 at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
 at Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
 at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
 at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)</pre>

I checked that Hyper-V was installed but it seems that Docker also needs to have the Powershell tools installed. So activate the feature and Docker will run fine 🙂

elmore_blog_docker_windows_powershell02

VMWare PowerCLI script: increase RAM and update VMWare Tools

January 11th, 2016 No comments

The other day I had to increase the memory of 30 virtual servers and install the latest VMWare tools. Instead of doing this manually I uses PowerCLI.

Put the serverlist in a *.txt file that is located in the same folder as the PowerShell script. This will shutdown the server, increase the RAM to 4GB, start the server and then upgrade the VMWare tools.

$servers = Get-Content -Path E:\path_to_my_folder\server_list.txt

get-vm $servers | Shutdown-VMGuest –Confirm:$False

sleep 150

Get-VM $servers | Set-VM –MemoryGB 4 –Confirm:$False | Start-VM

sleep 120

Get-VM $servers | Update-tools -RunAsync

QIK Wizard: add dependency files

August 17th, 2010 No comments

When you create a new Assembly that needs a dependency file to run you will need to add this file to the Integration Pack when building. In my case I wanted to execute some PowerShell commands from a file.

I installed PowerShell v2.0 so your command would be

powershell -file .&lt;myscript.ps1&gt; &lt;func1&gt; &lt;arg0&gt;

but this doesn’t work from an Integration Pack since it will look for the file in C:WindowsSystem32

The Integration Pack copies dependency files to

C:Program FilesCommon FilesOpalis SoftwareOpalis Integration ServerExtensionsSupportbin

and this folder is part of the Environment Variable PATH

So changing your command to this solves that problem and the Integration Pack executes the commands from the PowerShell file

powershell.exe &lt;myscript.ps1&gt; &lt;func1&gt; &lt;arg0&gt;

It’s off course better to use a custom dll-file but I don’t have any experience with C# so that’s for later.

I’ll post my own custom Integration Pack later this week!

Categories: QIK Tags: , ,

Powershell: check installed version

August 12th, 2010 No comments

It might be usefull to know which version of Powershell is installed on your server / desktop.
Open a dos-prompt and then open a PowerShell session. There are 3 ways to check the installed version

Method 1

$Host.Version

Method 2

get-host


Method 3 (works only with v2)

$PSVersionTable

Categories: Powershell, Scripts Tags: , ,