{"id":32,"date":"2014-07-23T13:41:48","date_gmt":"2014-07-23T12:41:48","guid":{"rendered":"http:\/\/banfi.co.uk\/blog\/?p=32"},"modified":"2014-07-23T13:42:01","modified_gmt":"2014-07-23T12:42:01","slug":"powershell-w-exchange-in-vb-net","status":"publish","type":"post","link":"https:\/\/banfi.co.uk\/blog\/2014\/07\/powershell-w-exchange-in-vb-net\/","title":{"rendered":"Powershell w\/ Exchange in vb.net &#8211; Work in Progress"},"content":{"rendered":"<p>I used this code to connect up to Exchange through Powershell with vb.net.<\/p>\n<p>However this is not the release code used in my projects as thats went missing&#8230;. &#8211; so I&#8217;m sticking this here with a view to update if \/ when I find my code.<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nPrivate Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click\r\n        Dim rsConfig As RunspaceConfiguration\r\n        rsConfig = RunspaceConfiguration.Create()\r\n        Dim snapInException As PSSnapInException = Nothing\r\n        Dim info As PSSnapInInfo\r\n        info = rsConfig.AddPSSnapIn(&quot;Microsoft.Exchange.Management.PowerShell.E2010&quot;, snapInException)\r\n        Dim myRunSpace As Runspace\r\n        myRunSpace = RunspaceFactory.CreateRunspace(rsConfig)\r\n        myRunSpace.Open()\r\n        Dim pipeLine As Pipeline\r\n        pipeLine = myRunSpace.CreatePipeline()\r\n        Dim myCommand As New Command(&quot;Get-Command&quot;)\r\n        pipeLine.Commands.Add(myCommand)\r\n        Dim commandResults As System.Collections.ObjectModel.Collection(Of PSObject)\r\n        commandResults = pipeLine.Invoke()\r\n        For Each cmdlet As PSObject In commandResults\r\n            Dim cmdletName As String\r\n            cmdletName = cmdlet.Properties(&quot;Name&quot;).Value.ToString()\r\n\r\n        Next\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I used this code to connect up to Exchange through Powershell with vb.net. However this is not the release code used in my projects as thats went missing&#8230;. &#8211; so I&#8217;m sticking this here with a view to update if \/ when I find my code. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles &hellip; <a href=\"https:\/\/banfi.co.uk\/blog\/2014\/07\/powershell-w-exchange-in-vb-net\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Powershell w\/ Exchange in vb.net &#8211; Work in Progress<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,5],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-powershell","category-vb-net"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":4,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}