PowerShell – getting Errors using AutoITx3.dll

August 9, 2014

Normally you can get all Methods and Properties of any registered COM object using the Get-member cmdlet.

But occasionally you get this error.


The reason is that you have registered the COM object only as x32 bit and not as x64 bit.

2 ways to solve this.

First register both x32 and x64 bit Dll’s.


After registering both versions this was the result.


New-Object -com AutoItX3.Control | Get-Member


Lucky for us that AutoIT ships 2 versions. But most of the DLL are either x32 or x64 bit ?

So you can get it running using the x32 bit if Powershell using the x32 bit of the COM Dll and the same for x64.

Or try a hack to register the x32 Bit like this :

The 32-bit one goes into C:\Windows\SysWOW64, and the 64-bit DLL goes into C:\Windows\System32.

And appropriate registry keys in the appropriate location



PowerShell – Using AutoIT COM object

January 21, 2013


This example shows how to run the AU3 Com object in Powershell.

# AutoIT declare object in PS
$oAutoIt = New-Object -comobject AutoItX3.Control

# This will List all the methods and properties of the COM object
$oAutoIt | get-member

# This will create a tooltip in the upper left of the screen
$oAutoIt.ToolTip("This is an AU3 tooltip Example" , 300, 430) 

# Important don't leave a spaces after the properties like this
# is wrong $oAutoIt.Sleep (2000) but like this => $oAutoIt.Sleep(2000)


You can use any COM object in Powershell as you can see.

For a .Net assambly or Powershell integration look here

Enjoy !

PowerShell – Export to EXCEL Issue

January 14, 2013

I was trying to use some simple script to create a workbook in Excel 2007 and add some worksheets in it, with data.

Spend hours on it, but it just opened up the Excel application. But no workbook and no sheets ? Crying face

This was the intial code :

#[threading.thread]::CurrentThread.CurrentCulture = 'en-US'
$Excel = new-Object -com Excel.Application
$Excel.visible = $True
$Excel.DisplayAlerts = $False
$ExcelWB = $Excel.Workbooks.Add()

# adding 3 extra sheets
$Sheet = $ExcelWB.Worksheets.Add()
$Sheet = $ExcelWB.Worksheets.Add()
$Sheet = $ExcelWB.Worksheets.Add()

# Assign each worksheet to a variable and
# name the worksheet.
$Sheet1 = $ExcelWB.Worksheets.Item(1)
$Sheet2 = $ExcelWB.WorkSheets.Item(2)
$Sheet3 = $ExcelWB.WorkSheets.Item(3)
$Sheet4 = $ExcelWB.WorkSheets.Item(4)
$Sheet5 = $ExcelWB.WorkSheets.Item(5)
$Sheet6 = $ExcelWB.WorkSheets.Item(6)
$Sheet1.Name = "General"
$Sheet2.Name = "System"
$Sheet3.Name = "Processor"
$Sheet4.Name = "Memory"
$Sheet5.Name = "Disk"
$Sheet6.Name = "Network"
Sleep 2
write-host $Error[0]
Sleep 2


On the second line you can notice the line including

[threading.thread]::CurrentThread.CurrentCulture = 'en-US'

When you uncomment it, everything works fine ?

Reason is that I use an English OS with a non English regional settings, which seems to be the issue.