Archive for the ‘PowerShell’ Category

Misleading ‘Pipe’ Symbol Location on Microsoft Keyboard

Microsoft

During my first proper outing into the world of VMware PowerCLI I had to start using the pipe (ie: | ) symbol in some of my command expressions within the command window.  Now, the pipe symbol on my Microsoft keyboard appeared straight forward enough (see image below) on the keyboard’s layout though upon pressing it in the PowerCLI window I received a broken looking pipe symbol instead (ie: ¦ ) which of course PowerCLI doesn’t like when I tried to execute the command.  Strangely enough when I pressed shift and the broken pipe looking symbol to the left of the ‘z’ key this, unsurprisingly, produced a broken pipe symbol… though upon executing the command in the PowerCLI window it worked.

Lesson Learnt: Use ‘shift’ and the broken pipe symbol (see below) on my Microsoft keyboard to achieve the pipe symbol, even if it doesn’t look like a pipe symbol in the PowerCLI command window or on the physical keyboard.  Note: I did check that I had the correct keyboard mappings in place within my Windows 7 OS.

Microsoft Keyboard Pipe Symbol

 

Using Task Scheduler to run a PowerShell Script

Although this is quite a straight forward thing to implement searching around on the web it did appear that there is some confusion around what to put where when specifying a PowerShell script from Windows Server Task Scheduler. 

So I thought I’d put together this brief post.  In this example I am using MS Windows Server 2008 to schedule a PowerShell to run.  If we were to try and run a PowerShell from a normal command line we’d type the following:

powershell.exe –Noninteractive –Noprofile –Command “&{<fullpath to script>}”

Notice that I didn’t specify the path to the powershell executable – the reason for this being that I have the path already specified in the servers Path environment variable, ie: %SystemRoot%\system32\WindowsPowerShell\v1.0\

If you haven’t already done this you’ll have to specify the full path to the PowerShell executable – this is a real faff (a technical term  :) ) so I’d recommend adding it your path environment variable if you haven’t done so.

When scheduling a new task and specifying the action (ie: in this case running a PowerShell script) the core of your syntax will be in the ‘Arguments’ section of the action (see below).

Use the image below as a template and enter the directory containing your PowerShell script in the ‘Start in’ setting field.

image

When completed you should have something similar to the action below.

image

Happy PowerShelling…  :)

 

StarWind Software
AppAssure
VMware vSphere Recommended Reads
Trilead
TechHead Needs You - Top 25 Blog Sites
Veeam #1
TrainSignal - vSphere Pro