Hello
I would like to use the following PowerShell script, however, while executing$outlook = new-object -comobject outlook.application nothing is return to the $Outlook variable.. I am using OUTLOOK 2010 release.
I found the COM outlook.application after executing“Get-WmiObjectWin32_COMClass “and “Get-ChildItemHKLM:\Software\Classes“
I am missing something.
Thank you in advance.
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = new-object -comobject outlook.application
$namespace = $outlook.GetNameSpace("MAPI")
$folder = $namespace.getDefaultFolder($olFolders::olFolderJunk)
$folder.items.count
Learning PowerShell scripting