How to check the Powershell Version and DotNet Version on Windows 10 IoT Core

December 31, 2016

Just run this command and check your version.




As you can see that Windows 10 IoT core has PSEdition already installed.

Not sure yet if this is the same as DotNet Core ?


Best check for regular updates using the Web Interface.


Accessing Raspberry PI3 – WMI Classes remotely using WBEM installed on Windows 10 Core IoT

December 30, 2016

Start using Powershell on Windows IoT on a Raspberry PI3

If you check all the available COM objects that are installed on the Windows 10 Core IoT, we see that WMI and WBEM is installed.

List all COM Objects like this.


This enables opportunities for Scripters to connect remote to access all available WMI classes Smile.

But unfortunately I always got an error message like this :

The RPC server is unavailable 0x800706BA

Solution :

First connect using WSMAN to connect to the RPI3 using PS

See my previous post Running Powershell Scripts on Windows 10 Core IoT installed on a Raspberry PI3



Once the Firewall is set correct, you have the way open to access the WMI classes remotely, without having to first access the local PI3 using WSMAN Winking smile

So let’s test it accessing the EventLogs on Windows IoT


Now that we have remote access we can use PS to list all EventLog Errors in a GRID to check what is going wrong.



All log files are located here :


You can also use other Scripting languages like VBScript

strComputer = “rpi3”
Set objSWbemLocator = CreateObject(“WbemScripting.SWbemLocator”)
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
“Root\CIMv2”, _
“rpi3\administrator”, _

Set colItems = objSWbemServices.ExecQuery(“Select * from Win32_ComputerSystem”,,48)

For Each objItem in colItems
Wscript.Echo strComputer & ” responded.”
Wscript.Echo “Manufacturer: ” & objItem.Manufacturer
WScript.Echo “Model: ” & objItem.Model
Wscript.Echo “Status ” & objItem.Status
Wscript.Echo “SystemType: ” & objItem.SystemType


Or AU3 to remotely access the WMI Classes on the PI3 Smile



$StrCmp = "rpi3"
$StrUser = "rpi3\administrator"
$StrPswd = "P@ssW0rd"

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$strComputer = "rpi3"
$objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$objSWbemServices = $objSWbemLocator.ConnectServer($StrCmp, "root\cimv2", $StrUser, $StrPswd)

$colItems = $objSWbemServices.ExecQuery("Select * from Win32_ComputerSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

For $objItem in $colItems
          ConsoleWrite($strComputer & " responded." & @CRLF)
          ConsoleWrite("Manufacturer: " & $objItem.Manufacturer & @CRLF)
          ConsoleWrite("Model: " & $objItem.Model & @CRLF)
          ConsoleWrite("Status " & $objItem.Status & @CRLF)
          ConsoleWrite("SystemType: " & $objItem.SystemType & @CRLF)

Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

Build your first Console App for an ARM Architecture:

If you are interested in taking it a few steps further, you can here how to build a Console App EXE for IoT.

Happy Scripting !

Running Powershell Scripts on Windows 10 Core IoT installed on a Raspberry PI3

December 29, 2016

Microsoft released a Windows 10 IoT Core version for Raspberry PI 2 & 3.

To install this it just go here select your hardware follow the steps, and  it will go as a piece of a PI  Winking smile



Windows IoT Web Interface

Once you have the Windows Core IoT running on your RPI you can access it over the web

IP address + Port 8080


Access using the Windows 10 Client App

Don’t forget to switch on the REMOTE SERVER switch first.


Powershell access to Windows IoT on as PI3

Next you can connect to it using Powershell

Run the PS IDE as administrator and run this command.


net start WinRM

Set-Item WSMan:\localhost\Client\TrustedHosts -Value rpi3

Enter-PSSession -ComputerName rpi3 -Credential administrator

Once logged in remotely using PS WSMAN connection, see the device name appearing.


You can check the PS Version : Check PS Version

Windows IoT Dashboard Application

You can also use the dashboard to launch a PS Session


File Sharing and internet connection Sharing

You can also connect to the file system using a regular Share access.



Starting the FTP server on IOT

Use PS and type start C:\Windows\System32\ftpd.exe

Connect using SSH Terminal

Windows 10 IoT Core Command Line Utils

Many command line Utils are at your disposal :


You can run regular PS Commands against the RPI3 Smile


There is also a screen capturer to make print screens : Screencapture.exe






WMI using WMIC Util over WSMAN PS connection

wmic bios

wmic cpu get name

wmic cpu get maxclockspeed


Here you can see that the RPI3 runs on an ARM 7 processor at 1200 Mhz

WMI Access from a desktop host using WBEM

This opens a lot of possibilities for us scripters to create apps and retrieve system data and more …

WMI WBEM Example

MS Firewall Logging Setting

You can activate the Firewall logging which makes it easy for debugging.



AU3 Powershell Module on Raspberry PI3

First copy the libraries on the RPI3


Here you can see all the Cmdlet’s from the AU3 Powershell module



Not that you can do a lot with it, since all the underlying AU3 Dll’s have been compiled using an X86 architecture.

And they will not run on an ARM architecture unfortunately.

Happy Scripting …

Enjoy !

Powershell – Access Windows Search

February 10, 2015

Windows has a Search feature that integrates in the OS and as well in Outlook.

Using the Control Panel you access the settings, which folders to index and which folders or Email folders.



To access the Search database you can use the “Search.CollatorDSO” Provider.


#$GENERAL_COLUMNS = "System.Kind"
$GENERAL_COLUMNS = "System.ItemPathDisplay"
#$GENERAL_COLUMNS = "System.ItemFolderPathDisplay"
#$GENERAL_COLUMNS = "System.Size"
#$GENERAL_COLUMNS = "System.DateCreated"
#$GENERAL_COLUMNS = "System.Author"
#$GENERAL_COLUMNS = "System.Keywords"

#$GENERAL_COLUMNS = "System.Image.HorizontalSize"
#$GENERAL_COLUMNS = "System.Image.VerticalSize"
#$GENERAL_COLUMNS = "System.Image.BitDepth"
#$GENERAL_COLUMNS = "System.Image.Compression"
#$GENERAL_COLUMNS = "System.Photo.CameraModel"
#$GENERAL_COLUMNS = "System.Photo.DateTaken"
#$GENERAL_COLUMNS = "System.Photo.Flash"

#$GENERAL_COLUMNS = "System.Music.Artist"
#$GENERAL_COLUMNS = "System.Music.Genre"
#$GENERAL_COLUMNS = "System.Music.TrackNumber"
#$GENERAL_COLUMNS = "System.Audio.Compression"
#$GENERAL_COLUMNS = "System.Audio.SampleRate"
#$GENERAL_COLUMNS = "System.DRM.IsProtected"
#$GENERAL_COLUMNS = "System.Music.AlbumTitle"
#$GENERAL_COLUMNS = "System.Rating"
#$GENERAL_COLUMNS = "System.Audio.EncodingBitrate"

#$VIDEO_COLUMNS = "System.RecordedTV.ChannelNumber"
#$VIDEO_COLUMNS = "System.RecordedTV.EpisodeName"
#$VIDEO_COLUMNS = "System.RecordedTV.NetworkAffiliation"
#$VIDEO_COLUMNS = "System.RecordedTV.RecordingTime"
#$VIDEO_COLUMNS = "System.Video.Compression"
#$VIDEO_COLUMNS = "System.Video.EncodingBitrate"
#$VIDEO_COLUMNS = "System.Video.FrameHeight"
#$VIDEO_COLUMNS = "System.Video.FrameWidth"    
$keyword1 = "PowerShell"  
$keyword2 = "au3"  
$extension = ".PDF"
$folder = "C:\"  

$objConnection = New-Object -com ADODB.Connection  
$objRecordSet = New-Object -com ADODB.Recordset

$objConnection.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")  
$objRecordSet.Open("SELECT $GENERAL_COLUMNS FROM SYSTEMINDEX WHERE System.FileExtension = '$extension' `
                    AND (Contains(Contents,'$keyword1') OR Contains(Contents, '$keyword2')) `
                    AND System.ItemPathDisplay LIKE '$folder\%'", $objConnection)  

if ($objRecordSet.EOF -eq $false) {$objRecordSet.MoveFirst() }  
while ($objRecordset.EOF -ne $true) {  

rv folder, extension, keyword1, keyword2

As you can see there are many columns you can search. Or using some Queries you can run this on your indexed mails


The bonus you get it that you can use this technology to do Remote Search over your network on a remote server or PC.

Enjoy !

Powershell – Running Parallel Workflows FAST !

January 9, 2015

Windows Workflows are really great in particular to execute parallel code.

When would you want to use this ?

Let’s take this example, where you want to know all IP addresses of the PC’s in your network.

It you had to scan them 1 by 1 sequentially it would be a SLOW process.

Therefore the new feature of Windows Workflows in PS v3.0 it the tool to use. In combination with the parallel execution parameter.

But you might run in to this error if you are trying to use Parameters in you Workflow statement.

Positional parameters are not supported in a Windows PowerShell Workflow. To invoke this command, use explicit parameter names with all values. For example: “Command -Parameter <value>”.
+ CategoryInfo          : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : PositionalParametersNotSupported


It took me a more then an hour to figure out what this meant and another hour to figure out how to correct it.

I ran this code and got the above error ?


import-module activedirectory

workflow Invoke-ForEachParallel-WF  {


 # The contents of the foreach block will be executed in parallel
 # look at the keyword -parallel

 foreach -parallel ($computer in $computerName)
 { # "Executing on $computer"
   test-connection -count 1 $computer


Invoke-ForEachParallel-WF  (Get-AdComputer -filter {(Name -Like "srv*") } | select name -ExpandProperty name)

Solution :


import-module activedirectory

workflow Invoke-ForEachParallel-WF  {


 # The contents of the foreach block will be executed in parallel
 # look at the keyword -parallel

 foreach -parallel ($computer in $computerName)
 { # "Executing on $computer"
   test-connection -count 1 -ComputerName $computer
   # Look at the special syntax -ComputerName + variable $computer


Invoke-ForEachParallel-WF  (Get-AdComputer -filter {(Name -Like "srv*") } | select name -ExpandProperty name)

Look at the special extra parameter “-ComputerName” value in the foreach code block

The code runs realy fast and will give you this kind of output.


Hope this will save you all some time.

Powershell – Using the .Net Charting Controls

January 4, 2015

Picked this up on the internet Smile Great extension to Powershell and .NET

What you need to get started is the

Microsoft Chart Controls for Microsoft .NET Framework 3.5

The Charting Controls documentation is here :

Microsoft Chart Controls for .NET Framework Documentation


Once installed you are ready to go, here is an example script showing the top 5 largest files in a directory.


If you hit the “Save button” it will save the graph to the desktop.

Here is the script :


if([Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization") -eq $null)
    #Microsoft Chart Controls are not installed
    [void][reflection.assembly]::Load("System.Windows.Forms, Version=,`
    Culture=neutral, PublicKeyToken=b77a5c561934e089")
    [void][System.Windows.Forms.MessageBox]::Show("Microsoft Chart Controls for Microsoft .NET 3.5`
    Framework is required", "Microsoft Chart Controls Required")
    #Open the URL
    return $false

# load the appropriate assemblies 

# create chart object 
$Chart = New-object System.Windows.Forms.DataVisualization.Charting.Chart 
$Chart.Width = 500 
$Chart.Height = 450
$Chart.Left = 40 
$Chart.Top = 30
# create a chartarea to draw on and add to chart 
$ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea 

# add data to chart 
$Files = dir $env:USERPROFILE -Recurse -File | sort length  | select -last 5 # | % {"$_.Name " + [math]::Round(($_.Length / 1MB),2)}
$FileNames = @(foreach($File in $Files){$File.Name}) 
$FileSize = @(foreach($File in $Files){[math]::Round(($File.Length / 1MB),2)}) 

$Chart.Series["Data"].Points.DataBindXY($FileNames, $FileSize)

# add title and axes labels 
[void]$Chart.Titles.Add("Top 5 Files - Descending") 
$ChartArea.AxisX.Title = "File Name" 
$ChartArea.AxisY.Title = "File Size - [MB]"

# Find point with max/min values and change their colour 
$maxValuePoint = $Chart.Series["Data"].Points.FindMaxByValue() 
$maxValuePoint.Color = [System.Drawing.Color]::Red 

$minValuePoint = $Chart.Series["Data"].Points.FindMinByValue() 
$minValuePoint.Color = [System.Drawing.Color]::Green

# change chart area colour 
$Chart.BackColor = [System.Drawing.Color]::Transparent

# make bars into 3d cylinders 
$Chart.Series["Data"]["DrawingStyle"] = "Cylinder"

# display the chart on a form 
$Chart.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right -bor 
                [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left

# sorting the dataset
$Chart.Series["Data"].Sort([System.Windows.Forms.DataVisualization.Charting.PointSortOrder]::Descending, "Y")

# add a save button 
$SaveButton = New-Object Windows.Forms.Button 
$SaveButton.Text = "Save" 
$SaveButton.Top = 500 
$SaveButton.Left = 450 
$SaveButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right 
$SaveButton.add_click({$Chart.SaveImage($Env:USERPROFILE + "\Desktop\Chart.png", "PNG")}) 

# save chart to file 
$Chart.SaveImage($Env:USERPROFILE + "\Desktop\Chart.png", "PNG")

$Form = New-Object Windows.Forms.Form 
$Form.Text = "PowerShell Chart" 
$Form.Width = 600 
$Form.Height = 600 



A good way to start is reading here :

You can build some nifty Tools with this ?



Powershell – Output to a GUI

January 4, 2015

Ever wanted to get the output of PowerShell to a GUI.

Well that’s not so difficult, since PS is built on top op .NET you can use the .NET Forms Class for this.

This example will capture your Computer Name, and the Process list and display it is a list box.


# add a Listbox
$objListBox = New-Object Windows.Forms.Listbox
$objListBox = New-Object System.Windows.Forms.ListBox
$objListBox.Location = New-Object System.Drawing.Size(15,10)
$objListBox.Size = New-Object System.Drawing.Size(550,10)
$objListBox.Height = 400

# add a save button
$oButton = New-Object Windows.Forms.Button
$oButton.Text = "Get Computer Name"
$oButton.Top = 500
$oButton.Left = 350
$oButton.Width = 150
$oButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right 

$oButton.add_click({$SaveButton.Text = $env:ComputerName})


$sTemp = Get-Process 

$sTemp | % {  $item = $_.ProcessName
$objListBox.Items.Add($item) }


# Build the GUI
$Form = New-Object Windows.Forms.Form
$Form.Text = "PowerShell Output"
$Form.Width = 600
$Form.Height = 600 




rv objListBox, Form, oButton, sTemp, item

When pressing the button it will trigger the actions Winking smile