<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Parallel Universe - MS Tech Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/feed.xml</link>
    <description>The ramblings of a techy @ microsoft</description>
    <lastBuildDate>Tue, 16 Apr 2019 06:14:07 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Getting all operations for all Providers so create custom roles in RBAC for Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/getting-all-operations-for-all-providers-so-create-custom-roles-in-rbac-for-azure</link>
      <pubDate>Mon, 29 Aug 2016 23:30:44 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/?p=1125</guid>
      <description><![CDATA[Today I was asked to help a customer find ALL the roles available for inclusion into a RBAC role’s...]]></description>
      <content:encoded><![CDATA[Today I was asked to help a customer find ALL the roles available for inclusion into a RBAC role’s they possibly want to create.

There is no definitive list I could find but it definitely is there in Azure somewhere

So I wrote a little script that helps exports all the Providers and Operations you can do for each provider so that you can look and select.

First we login to Azure

Login-AzureRmAccount

Next we use the CmdLet Get-AzureRMProviderOperation

$allOps = Get-AzureRmProviderOperation -OperationSearchString *

This will retrieve EVERYTHING

I am just dropping a text file into a directory per provider for review afterwards but you could export it to a CSV and full filter it.. if you want  however I just wanted something quick and simple so the logic is as follows
<div>$sourcedir = $env:userprofile + "\Desktop\AzureRBAC"
$testdir =test-path $sourcedir
if($testdir -eq $false)
{
new-item -type directory $sourcedir
}</div>
<div>for($i=0;$i -lt $allops.count;$i++)
{
$name = $allops[$i].Operation.split("/")[0]

$objarr = @()
$filename = $sourcedir + "\" + $name + ".txt"
for($p=0;$p -lt $allops.Count;$p++)
{


if($name -eq $allops[$p].Operation.split("/")[0])
{
$obj = new-object psobject
$obj |Add-Member -MemberType NoteProperty -Name Provider -Value $name -Force
$obj |Add-Member -MemberType NoteProperty -Name OperationName -Value $allOps[$p].OperationName -Force
$obj |Add-Member -MemberType NoteProperty -Name Operation -Value $allOps[$p].Operation -Force
$objarr += $obj

}

}
$objarr |out-file $filename

</div>
<div>}</div>
It will create a separate text file for each provider and the actions you can perform.. you can choose to be very selective in your RBAC role then..]]></content:encoded>
    </item>
    <item>
      <title>Update</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/update</link>
      <pubDate>Thu, 10 Mar 2016 15:50:55 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2016/03/10/update/</guid>
      <description><![CDATA[&nbsp; Hey all So I have been quite for a while… this is mainly due to high workloads but also I...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>Hey all</p> <p>So I have been quite for a while… this is mainly due to high workloads but also I moved!</p> <p>I am now a resident in San Francisco! <img class="wlEmoticon wlEmoticon-smile" style="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none;" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/wlEmoticon-smile_35ADB921.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/wlEmoticon_2D00_smile_5F00_35ADB921.png" /></p> <p>Will be trying to put more online in the coming weeks as I come across little bits… </p> <p>John</p>]]></content:encoded>
    </item>
    <item>
      <title>Deploy a VM with Azure PowerShell Preview 1.0 Cmdlets</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/deploy-a-vm-with-azure-powershell-preview-1-0-cmdlets</link>
      <pubDate>Tue, 03 Nov 2015 23:05:56 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2015/11/03/deploy-a-vm-with-azure-powershell-preview-1-0-cmdlets/</guid>
      <description><![CDATA[&nbsp; There are tons of examples out there and to be honest this is for as much my reference to go...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p><em>There are tons of examples out there and to be honest this is for as much my reference to go back and grab it when I need it.</em></p> <p><em>so here is a simple script nothing fancy whatsoever but functional <img class="wlEmoticon wlEmoticon-smile" style="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none;" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/wlEmoticon-smile_3E3A0E6C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/wlEmoticon_2D00_smile_5F00_3E3A0E6C.png" /></em></p> <p><em>First part lets collect the name you want to assign to the Virtual Machine you are building in Azure! and import the AzureRM module. I am specifically calling AzureRM as I am importing all azure resource modules. However I could just call the ones I need</em></p> <p>$vmname = &quot;&lt;insert-your-VM-Name&gt;&quot;<br />import-module AzureRM</p> <p><em>These next two lines are for me specifically, I have multiple subscriptions and want to deploy to a specific one so I am just getting all subscriptions available and then referencing the one of interesting. Interestingly enough you need to specify the tenantId and subscriptionID to select the subscription of interest now…</em></p> <p><br />$subs = Get-AzureRmSubscription -All<br />Select-AzureRmSubscription -TenantId $subs[4].TenantId -SubscriptionId $subs[4].SubscriptionId<br /></p> <p><em>Next I select the storage account, in the subscription I am working with there is just one… in your environment you might want to filter out</em></p> <p>$storacct = Get-AzureRmStorageAccount</p> <p><em>Next we construct the name for the VHD and access the public blob endpoint URI so we can construct a full path to the VHD for later use</em></p> <p><br />$diskname = $vmname + &quot;_OSDisk&quot;<br />$vhduri = $storacct.PrimaryEndpoints.Blob.OriginalString + &quot;vhds/${diskname}.vhd&quot;<br /></p> <p><em>Next we specify out the resource group name we want to assign our VM to, I had previous created one I wanted to use. and then we also specify the location because it seems ever CmdLet wants it now <img class="wlEmoticon wlEmoticon-smile" style="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none;" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/wlEmoticon-smile_3E3A0E6C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/wlEmoticon_2D00_smile_5F00_3E3A0E6C.png" /></em></p> <p>$rg = &quot;SCDEMO&quot;<br />$loc = &quot;North Europe&quot;</p> <p><em>Next we select the image we are interested in, and you can vary this as you need</em></p> <p>$image = get-azurermvmimage -Location $loc -PublisherName &quot;MicrosoftWindowsServer&quot; -Offer &quot;WindowsServer&quot; -Skus &quot;2012-R2-Datacenter&quot; -Version 4.0.20150916<br /></p> <p><em>Now we grab the Vnet and Subnet I previously created as I generally have these in place and don’t really want to create one every time I create a Virtual machine</em></p> <p>$vNet = Get-AzureRmVirtualNetwork<br />$subnet = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vNet</p> <p><em>Now I create new nic with construct the nic name from the VMName, honestly you can assign what ever name you want to a nic as long as its unique to the resource group</em></p> <p>$nic = New-AzureRmNetworkInterface -Name &quot;${vmname}_nic1&quot; -Subnet $subnet -Location $loc -ResourceGroupName $rg <br /></p> <p><em>We need to capture some credential information, I chose to do it this way as I will loop this code up into a function and want the same username and password for everything but you can prompt using get-credentials if you want</em></p> <p>$secpassword = convertto-securestring &quot;LS1setup!&quot; -asplaintext -force<br />$username = &quot;msadmin&quot;<br />$creds = New-Object System.Management.Automation.PSCredential($username, $secpassword)</p> <p><em>Now here is the part that in every example I see you pipe everything along and more times than not I see people struggle with copying the pipe and getting to work, so I decided to do it this way… First I create the VMConfig variable to store all my settings in and as you can see I constantly reference it in each line.</em></p> <p><em>In this first line I create the variable as previously said, assign the VM Name and specify the size</em></p> <p>$vmconfig = New-AzureRmVMConfig&nbsp; -VMName $vmname -VMSize &quot;Standard_A2&quot;</p> <p><em>Next we configure some items around the Operating system, like the local admin credentials and the computername which is the same as the VM Name in my case but you can choose to have it different.</em></p> <p>Set-AzureRmVMOperatingSystem -Windows -VM $vmconfig -ProvisionVMAgent -EnableAutoUpdate -Credential $creds -ComputerName $vmname<br /></p> <p><em>Next we specify the source image to “clone” off as such…</em></p> <p>Set-AzureRmVMSourceImage -VM $vmconfig -PublisherName $image.PublisherName -Offer $image.Offer -Skus $image.Skus -Version $image.Version</p> <p><em>As NICS are a separate object now we need to assign our previously created NIC to the actual VM</em></p> <p>Add-AzureRmVMNetworkInterface -VM $vmconfig -Id $nic.Id</p> <p><em>Now we tell the config we need to build a disk with a specific name and URI and give it the options as required</em></p> <p>Set-AzureRmVMOSDisk -VM $vmconfig -Name $diskname -VhdUri $vhduri -Caching ReadWrite -CreateOption fromImage</p> <p><em>Last but not least I deploy VM with all of the configuration options</em></p> <p>New-AzureRMVM -ResourceGroupName $rg -Location $loc -VM $vmconfig</p> <p><em>As I said not pretty but it works <img class="wlEmoticon wlEmoticon-smile" style="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none;" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/wlEmoticon-smile_3E3A0E6C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/wlEmoticon_2D00_smile_5F00_3E3A0E6C.png" /></em></p>]]></content:encoded>
    </item>
    <item>
      <title>Use Microsoft Update or Internal WSUS depending on your location</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/use-microsoft-update-or-internal-wsus-depending-on-your-location</link>
      <pubDate>Fri, 23 Oct 2015 11:57:55 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2015/10/23/use-microsoft-update-or-internal-wsus-depending-on-your-location/</guid>
      <description><![CDATA[&nbsp; Here is another case I was asked about how to have internal clients use the WSUS server they...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>Here is another case I was asked about how to have internal clients use the WSUS server they have published when connected to the corporate network and when outside the corporate network to use Microsoft Update</p> <p>First a simple PowerShell Script</p> <p>###################################################################3 <p>$intWsusServer = &quot;internalwsus.contoso.com&quot; <p>$ErrorActionPreference = &quot;SilentlyContinue&quot; <p>$ping = New-Object System.net.networkinformation.ping <p>$results = $ping.Send($intWsusServer) <p>if (!$results) <p>{ <p>#This means we cant resolve so we are outside the network and use microsoft update <p>Set-ItemProperty -erroraction &quot;SilentlyContinue&quot; hklm:\software\Policies\Microsoft\Windows\WindowsUpdate\AU\UseWUServer 1 <p>} <p>else <p>{ <p>#this means we are inside the network and says to usse internal WSUS server <p>Set-ItemProperty -erroraction &quot;SilentlyContinue&quot; hklm:\software\Policies\Microsoft\Windows\WindowsUpdate\AU\UseWUServer 0 <p>}  <p>##################################################################</p> <p>Save this to a file and Push this to the client so it is local on the machine.</p> <p>&nbsp;</p> <p>Next Create a task in task scheduler as follows </p> <p>1. Create Basic Task <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image002_4464420D.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image002_5F00_4464420D.jpg"><img title="clip_image002" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;display:inline;padding-right:0px;" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image002_thumb_4151E418.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image002_5F00_thumb_5F00_4151E418.jpg" width="244" height="173" /></a> <p>2. Select Specific Event <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image004_2139680C.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image004_5F00_2139680C.jpg"><img title="clip_image004" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;display:inline;padding-right:0px;" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image004_thumb_17740094.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image004_5F00_thumb_5F00_17740094.jpg" width="244" height="173" /></a> <p>3. Configure Trigger as specified <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image006_27169C56.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image006_5F00_27169C56.jpg"><img title="clip_image006" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;display:inline;padding-right:0px;" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image006_thumb_2F99FBA0.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image006_5F00_thumb_5F00_2F99FBA0.jpg" width="244" height="172" /></a> <p>4. Click Start a program <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image008_7F72B0DC.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image008_5F00_7F72B0DC.jpg"><img title="clip_image008" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;display:inline;padding-right:0px;" border="0" alt="clip_image008" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image008_thumb_25D724D9.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image008_5F00_thumb_5F00_25D724D9.jpg" width="244" height="171" /></a> <p>5. Enter location of script <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image010_7C62E398.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image010_5F00_7C62E398.jpg"><img title="clip_image010" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;display:inline;padding-right:0px;" border="0" alt="clip_image010" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image010_thumb_1DE21328.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image010_5F00_thumb_5F00_1DE21328.jpg" width="244" height="173" /></a> <p>6. Click Finish <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image012_5452C52A.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image012_5F00_5452C52A.jpg"><img title="clip_image012" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="clip_image012" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/clip_image012_thumb_38B0C9E5.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/clip_5F00_image012_5F00_thumb_5F00_38B0C9E5.jpg" width="244" height="173" /></a> <p>And you are done!</p> <p>Every time the network connection is connected it will invoke the script and test if it can ping the internal server, if it can it will use it , if not it will use Microsoft update</p> <p>Use the following link to push a task out to all clients via GPO, as part of the same GPO you can have a script which pulls the ps1 file down first</p> <p><a title="https://technet.microsoft.com/en-us/library/cc725745.aspx" href="https://technet.microsoft.com/en-us/library/cc725745.aspx">https://technet.microsoft.com/en-us/library/cc725745.aspx</a></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>]]></content:encoded>
    </item>
    <item>
      <title>Export all your Trusted Root Certificate from Local Machine store</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/export-all-your-trusted-root-certificate-from-local-machine-store</link>
      <pubDate>Thu, 22 Oct 2015 04:41:39 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2015/10/22/export-all-your-trusted-root-certificate-from-local-machine-store/</guid>
      <description><![CDATA[&nbsp; Today I was working on a case for a customer where every web page he visited he got a...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>Today I was working on a case for a customer where every web page he visited he got a security error in all browsers.</p> <p>The main message was “Could not Establish a Trust”</p> <p>It was a Windows 2008 R2 Server and after validating the name was correct on the certificate they were trying to connect to I looked at the certificate chain and verified it against the Trusted Root Certificate Store on the LocalMachine</p> <p>Anyway we found that there was only 8 certificates in the Trusted Root Store which is definitely not correct! </p> <p>So we need to take them from another box and import and here is a little PowerShell Script to help you do it!</p> <p>First we define the Type variable which will be specifying for later that we will export a certificate</p> <p>$type = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert </p> <p>Next we gather all the certificates from the Trusted Root Store in a working Machine</p> <p>$certs = get-childitem -path cert:\LocalMachine\AuthRoot </p> <p>Finally we loop true all certificates and in my examples case we export to a .DER file in the c:\temp directory</p> <p>foreach($cert in $certs)<br />{<br />&nbsp;&nbsp;&nbsp; $hash = $cert.GetCertHashString()<br />&nbsp;&nbsp;&nbsp; $path = &quot;c:\temp\&quot; + $hash + &quot;.der&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp; [System.IO.File]::WriteAllBytes($path, $cert.export($type) ) <br />} </p> <p>It gives the name of the file as the Certificate Hash</p> <p>And voila all the root certificates have been exported and you can copy and import on to the “broken” machine!</p>]]></content:encoded>
    </item>
    <item>
      <title>Lets start blogging again!</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/lets-start-blogging-again</link>
      <pubDate>Sat, 19 Sep 2015 00:35:20 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2015/09/19/lets-start-blogging-again/</guid>
      <description><![CDATA[Over the past few months, lots of have happened … tons of learning, various conferences and lots of...]]></description>
      <content:encoded><![CDATA[<p>Over the past few months, lots of have happened … tons of learning, various conferences and lots of writing.. not blogs but books and training material…</p> <p>hopefully now things are getting less hectic so I will start blogging again!</p> <p>look out for some posts very soon..</p>]]></content:encoded>
    </item>
    <item>
      <title>SMA Run book for enabling hyper-v replica after deployment in WAP</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/sma-run-book-for-enabling-hyper-v-replica-after-deployment-in-wap</link>
      <pubDate>Tue, 14 Apr 2015 15:03:22 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2015/04/14/sma-run-book-for-enabling-hyper-v-replica-after-deployment-in-wap/</guid>
      <description><![CDATA[In Windows Azure Pack you have the ability to link your Automation runbooks to an...]]></description>
      <content:encoded><![CDATA[<p>
 </p><p>In Windows Azure Pack you have the ability to link your Automation runbooks to an &quot;Event&quot; 
</p><p>One of the common things that I see is about providing a disaster recovery solution to a customer especially in a multi tenant environment..
</p><p>During VM creation we link our runbook to the Event as shown 
</p><p>
	</p><p>Now everytime a virtual machine is created it will run my EnableHyperVReplicaVM runbook
</p><p>
 </p><p>In the runbook code we access a hidden variable called $PSPrivateMetaData
</p><p>The important thing first is to get the VMM Job ID, as this allows us to monitor completion of the VMM Job before trying to enable hyper-v replica as otherwise it will fail!
</p><p>Another part in this runbook is we use the Get-AutomationConnection to allow us to execute against the VMM server and use the Service management automation Assets to the fullest!
</p><p>
 </p><p>Anyway here is the code! And remember there are hundreds of other ways of doing this! <span style="font-family:Wingdings;">J</span>
	</p><p>
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;">workflow</span>
			<span style="color:blueviolet;">EnableHyperVReplicaforVM</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">{
</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$params</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$PSPrivateMetaData<span style="color:darkgray;">.</span>params
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$VMMJobID</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$PSPrivateMetaData<span style="color:darkgray;">.</span>VMMJobId
</span></span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$vmmserver</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">Get-AutomationConnection</span>
			<span style="color:navy;">-Name</span>
			<span style="color:darkred;">&#39;VMMConnection&#39;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$SecurePassword</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">ConvertTo-SecureString</span>
			<span style="color:navy;">-AsPlainText</span>
			<span style="color:navy;">-String</span>
			<span style="color:orangered;">$vmmserver<span style="color:darkgray;">.</span>Password <span style="color:navy;">-Force</span>
			</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$Credential</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:navy;">-TypeName</span>
			<span style="color:blueviolet;">System.Management.Automation.PSCredential</span>
			<span style="color:navy;">-ArgumentList</span>
			<span style="color:orangered;">$vmmserver<span style="color:darkgray;">.</span>username<span style="color:darkgray;">,</span> $SecurePassword</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$replicaserver</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;svvmasp15.corp.contoso.com&quot;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$masterserver</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;svvmasp16.corp.contoso.com&quot;</span>
		</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$jobFinalState</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">InlineScript</span> {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Import-Module</span>
			<span style="color:blueviolet;">VirtualMachineManager</span>
		</span></p><p style="background:white;">
 </p><p style="background:white;">       
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">While</span> ((<span style="color:blue;">Get-SCJob</span>
			<span style="color:navy;">-ID</span>
			<span style="color:orangered;">$USING:VMMJobId</span>)<span style="color:darkgray;">.</span>Status <span style="color:darkgray;">-eq</span>
			<span style="color:darkred;">&#39;Running&#39;</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">      {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$jobProgress</span>
			<span style="color:darkgray;">=</span> (<span style="color:blue;">Get-SCJob</span>
			<span style="color:navy;">-ID</span>
			<span style="color:orangered;">$USING:VMMJobId</span>)<span style="color:darkgray;">.</span>ProgressValue
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Start-Sleep</span>
			<span style="color:navy;">-Seconds</span>
			<span style="color:purple;">3</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        }
</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$JobState</span>
			<span style="color:darkgray;">=</span> (<span style="color:blue;">Get-SCJob</span>
			<span style="color:navy;">-ID</span>
			<span style="color:orangered;">$USING:VMMJobId</span>)<span style="color:darkgray;">.</span>Status
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">Return</span>
			<span style="color:orangered;">$JobState</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    } <span style="color:navy;">-PSComputerName</span>
			<span style="color:orangered;">$VmmServer<span style="color:darkgray;">.</span>ComputerName <span style="color:navy;">-PSCredential</span> $Credential</span>
		</span></p><p style="background:white;">    
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$params</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$params</span>
			<span style="color:darkgray;">-split</span> (<span style="color:darkred;">&#39;,&#39;</span>) <span style="color:darkgray;">-replace</span> (<span style="color:darkred;">&#39;&quot;&#39;<span style="color:darkgray;">,<span style="color:darkred;">&#39;&#39;</span>) -replace</span> (&#39;{&#39;<span style="color:darkgray;">,<span style="color:darkred;">&#39;&#39;</span>) -replace</span> (&#39;}&#39;<span style="color:darkgray;">,<span style="color:darkred;">&#39;&#39;</span>)
</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$vmname</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">InlineScript</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;">        
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">Foreach</span> (<span style="color:orangered;">$p</span>
			<span style="color:darkblue;">in</span>
			<span style="color:orangered;">$USING:params</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$key</span>
			<span style="color:darkgray;">=</span> (<span style="color:orangered;">$p</span>
			<span style="color:darkgray;">-split</span> (<span style="color:darkred;">&#39;:&#39;</span>))<span style="color:darkgray;">[<span style="color:purple;">0<span style="color:darkgray;">]</span>
				</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$value</span>
			<span style="color:darkgray;">=</span> (<span style="color:orangered;">$p</span>
			<span style="color:darkgray;">-split</span> (<span style="color:darkred;">&#39;:&#39;</span>))<span style="color:darkgray;">[<span style="color:purple;">1<span style="color:darkgray;">]</span>
				</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">if</span>((<span style="color:orangered;">$key</span>
			<span style="color:darkgray;">-eq</span>
			<span style="color:darkred;">&quot;Name&quot;</span>) <span style="color:darkgray;">-and</span> (<span style="color:orangered;">$value</span>
			<span style="color:darkgray;">-ne</span>
			<span style="color:darkred;">&quot;null&quot;</span>))
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">            {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">return</span>
			<span style="color:orangered;">$value</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">            }
</span></p><p style="background:white;">                      
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        }
</span></p><p style="background:white;"> 
 </p><p style="background:white;">        
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;">            
 </p><p style="background:white;">            
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:blue;">write-output</span>
			<span style="color:darkred;">&quot;JobSate Result form VMM: <span style="color:orangered;">$jobFinalstate<span style="color:darkred;">&quot;</span>
				</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:blue;">write-output</span>
			<span style="color:darkred;">&quot;VMName: <span style="color:orangered;">$vmname<span style="color:darkred;">&quot;</span>
				</span></span></span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$represult</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">inlinescript</span> {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Import-Module</span>
			<span style="color:blueviolet;">Hyper-V</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Enable-VMReplication</span>
			<span style="color:navy;">–VMName</span>
			<span style="color:orangered;">$using:vmname</span>
			<span style="color:navy;">–ReplicaServerName</span>
			<span style="color:orangered;">$using:replicaserver</span>
			<span style="color:navy;">–ReplicaServerPort</span>
			<span style="color:purple;">80</span>
			<span style="color:navy;">-authenticationtype</span>
			<span style="color:blueviolet;">kerberos</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">start-vminitialreplication</span>
			<span style="color:navy;">-vmname</span>
			<span style="color:orangered;">$using:vmname</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$result</span>
			<span style="color:darkgray;">=</span> (<span style="color:blue;">get-vm</span>
			<span style="color:navy;">-name</span>
			<span style="color:orangered;">$using:vmname</span>)<span style="color:darkgray;">.</span>ReplicationState
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">return</span>
			<span style="color:orangered;">$result</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    } <span style="color:navy;">-PSComputerName</span>
			<span style="color:orangered;">$masterServer</span>
			<span style="color:navy;">-PSCredential</span>
			<span style="color:orangered;">$Credential</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">if</span> (<span style="color:orangered;">$represult</span>
			<span style="color:darkgray;">-eq</span>
			<span style="color:darkred;">&quot;Enabled&quot;</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$replicaenabled</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$true</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">else</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$replicaenabled</span>
			<span style="color:darkgray;">=<span style="color:orangered;">$false</span>
			</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;"> 
 </p><p style="background:white;"> 
 </p><p style="background:white;"> 
 </p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">write-output</span>
			<span style="color:darkred;">&quot;ReplicaEnabledResult: <span style="color:orangered;">$replicaenabled<span style="color:darkred;">&quot;</span>
				</span></span></span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">}
</span></p><p style="background:white;">
 </p><p style="background:white;"> 
 </p><p>
 </p>]]></content:encoded>
    </item>
    <item>
      <title>TechEd Europe 2014</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/teched-europe-2014</link>
      <pubDate>Sat, 01 Nov 2014 15:27:58 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2014/11/01/teched-europe-2014/</guid>
      <description><![CDATA[&nbsp; Last week in barcelona I had to privilege to present a session called In depth Introduction...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>Last week in barcelona I had to privilege to present a session called In depth Introduction to Service Management Automation!</p> <p>We have a nice room and it was pretty full… the best part about it is that it is recorded!</p> <p>So if you want to check the session see the channel 9 link below!</p> <p><a title="https://channel9.msdn.com/Events/TechEd/Europe/2014/CDP-B336" href="https://channel9.msdn.com/Events/TechEd/Europe/2014/CDP-B336">https://channel9.msdn.com/Events/TechEd/Europe/2014/CDP-B336</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Reading a Certificate off a remote SSL Server for Troubleshooting with Powershell!</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/reading-a-certificate-off-a-remote-ssl-server-for-troubleshooting-with-powershell</link>
      <pubDate>Thu, 26 Jun 2014 10:05:56 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2014/06/26/reading-a-certificate-off-a-remote-ssl-server-for-troubleshooting-with-powershell/</guid>
      <description><![CDATA[&nbsp; By no means is this a unique idea but here is my version…. :) The problem is trying to...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>By no means is this a unique idea but <a href="https://blogs.technet.com/b/parallel_universe_-_ms_tech_blog/archive/2013/12/17/troubleshooting-windows-azure-not-able-to-connect-to-remote-powershell-to-vm.aspx">here</a> is my version…. :)</p> <p>The problem is trying to validate a certificate on a secure port which you cannot browse to!</p> <p>For example Lync services can run on port 5061 and you will not be able to browse to that … at least I never was able to :)</p> <p>anyway here is a quick powershell script to do it for you and give you some information on the certificate back</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/image_77DA4475.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/image_5F00_77DA4475.png"><img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/89/55/metablogapi/image_thumb_1E6363C7.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-89-55-metablogapi/image_5F00_thumb_5F00_1E6363C7.png" width="604" height="324" /></a></p> <p>Copy and paste from here</p> <p>&nbsp;</p> <p>param([parameter(Mandatory=$true)][string]$computername,[parameter(Mandatory=$true)][int]$port)  <p>#Create a TCP Socket to the computer and a port number<br />$tcpsocket = New-Object Net.Sockets.TcpClient($computerName, $port)  <p>#test if the socket got connected<br />if(!$tcpsocket)<br />{<br />&nbsp;&nbsp;&nbsp; Write-Error &quot;Error Opening Connection: $port on $computername Unreachable&quot;<br />&nbsp;&nbsp;&nbsp; exit 1<br />}<br />else<br />{<br />&nbsp;&nbsp;&nbsp; #Socket Got connected get the tcp stream ready to read the certificate<br />&nbsp;&nbsp;&nbsp; write-host &quot;Successfully Connected to $computername on $port&quot; -ForegroundColor Green -BackgroundColor Black<br />&nbsp;&nbsp;&nbsp; $tcpstream = $tcpsocket.GetStream()<br />&nbsp;&nbsp;&nbsp; Write-host &quot;Reading SSL Certificate....&quot; -ForegroundColor Yellow -BackgroundColor Black <br />&nbsp;&nbsp;&nbsp; #Create an SSL Connection <br />&nbsp;&nbsp;&nbsp; $sslStream = New-Object System.Net.Security.SslStream($tcpstream,$false)<br />&nbsp;&nbsp;&nbsp; #Force the SSL Connection to send us the certificate<br />&nbsp;&nbsp;&nbsp; $sslStream.AuthenticateAsClient($computerName)  <p>&nbsp;&nbsp;&nbsp; #Read the certificate<br />&nbsp;&nbsp;&nbsp; $certinfo = New-Object system.security.cryptography.x509certificates.x509certificate2($sslStream.RemoteCertificate)<br />}  <p>$returnobj = new-object psobject<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;FriendlyName&quot; -Value $certinfo.FriendlyName<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;SubjectName&quot; -Value $certinfo.SubjectName<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;HasPrivateKey&quot; -Value $certinfo.HasPrivateKey<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;EnhancedKeyUsageList&quot; -Value $certinfo.EnhancedKeyUsageList<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;DnsNameList&quot; -Value $certinfo.DnsNameList<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;SerialNumber&quot; -Value $certinfo.SerialNumber<br />$returnobj |Add-Member -MemberType NoteProperty -Name &quot;Thumbprint&quot; -Value $certinfo.Thumbprint<br />$returnobj </p></p></p></p></p>]]></content:encoded>
    </item>
    <item>
      <title>Using Lync Client SDK to Automate Call Testing</title>
      <link>https://docs.microsoft.com/archive/blogs/parallel_universe_-_ms_tech_blog/using-lync-client-sdk-to-automate-call-testing</link>
      <pubDate>Wed, 28 May 2014 05:38:23 GMT</pubDate>
      <dc:creator><![CDATA[John McCabe [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2014/05/28/using-lync-client-sdk-to-automate-call-testing/</guid>
      <description><![CDATA[&nbsp; A while ago I did a blog post and it leverage the Lync Client SDK&nbsp; to do call testing...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>A while ago I did a blog post and it leverage the Lync Client SDK&nbsp; to do call testing but it was dependant on the users being in your contact list. This is ok to a degree but what if you needed to just provide an input list of sip uri’s that you needed to query.</p> <p>So I updated it :)</p> <p>The main 2 changes are I put it into a function and I used a sub-method that is under the $client.contactmanager called GetContactByURI. this method requires a single line of text to search for and it can return the contact object that we need to add to an IM or a call etc.. the $client btw is the instance of the lync client that is running.</p> <p>refer to the previous post for most of the explanation but I have tried to comment the code out pretty well.</p> <p>&lt;#<br /> .SYNOPSIS<br /> Runs an automated script to send a user an IM message, followed by a phone call. If the user picks up it puts the call on hold, plays a recorded file and hangs up<br /> .DESCRIPTION  <p>&nbsp; Create a file called inputfile.txt and enter each sipuri line by line, this script will test each user and generate a report at the end of it<br /> .PARAMETER Inputfile  <p> .EXAMPLE<br /> .\LyncAutomatedTest.ps1 -inputfile inputfile.txt<br /> #&gt;  <p>[CmdletBinding()]<br />param([Parameter(Mandatory=$true)][ValidateScript({Test-Path $_})][string]$inputfile)  <p>function TestSIPURI($sipuri,$client)<br />{  <p>&nbsp;&nbsp;&nbsp; write-verbose &quot;Testing For $sipuri has begun&quot;<br />&nbsp;&nbsp;&nbsp; $conversation = $client.ConversationManager.AddConversation()<br />&nbsp;&nbsp;&nbsp; $contact = $client.ContactManager.GetContactByUri($sipuri)<br />&nbsp;&nbsp;&nbsp; $null= $conversation.AddParticipant($contact)  <p>&nbsp;&nbsp;&nbsp; #First Send an Instant Message so we need the InstantMessage Modality<br />&nbsp;&nbsp;&nbsp; $IMType = 1<br />&nbsp;&nbsp;&nbsp; $PlainText = 0 <br />&nbsp;&nbsp;&nbsp; $data = New-Object &quot;System.Collections.Generic.Dictionary[Microsoft.Lync.Model.Conversation.InstantMessageContentType,String]&quot;<br />&nbsp;&nbsp;&nbsp; $data.Add($PlainText, &quot;This is an Automated Test... The Lync System Has Been Patched. Your desktop phone will be rung shortly to check its operation, The call will connect be put on hold where you will here some music and then end please wait until it completes&quot;)<br />&nbsp;&nbsp;&nbsp; #This sets the modality type <br />&nbsp;&nbsp;&nbsp; $message = $conversation.Modalities[$IMType]<br />&nbsp;&nbsp;&nbsp; write-host &quot;Sending Status IM&quot;<br />&nbsp;&nbsp;&nbsp; $null = $message.BeginSendMessage($data, $null, $data)<br />&nbsp;&nbsp;&nbsp; #Sleeping to allow the instant message to go through<br />&nbsp;&nbsp;&nbsp; sleep 20  <p>&nbsp;&nbsp;&nbsp; #for audio call changing the modality tpype<br />&nbsp;&nbsp;&nbsp; $ModalityType = 2<br />&nbsp;&nbsp;&nbsp; $message = $conversation.Modalities[$ModalityType]<br />&nbsp;&nbsp;&nbsp; write-host &quot;Making Phone Call&quot;<br />&nbsp;&nbsp;&nbsp; $null = $message.BeginConnect($null,$null)<br />&nbsp;&nbsp;&nbsp; sleep 20<br />&nbsp;&nbsp;&nbsp; if ($message.state -eq &quot;Connected&quot;)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $usercontact = $contact.uri.split(&quot;:&quot;)[1]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &quot;Successfully Connected Voice Call to:`t $usercontact&quot; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Idea to playback a WMA file which says the system is testing itself<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 10<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &quot;Switching Call to OnHold For Playback Music&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message.BeginHold($null,$null)<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $usercontact = $contact.uri.split(&quot;:&quot;)[1]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &quot;Could Not Connect a Voice Call to:`t $usercontact&quot; <br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; sleep 10<br />&nbsp;&nbsp;&nbsp; write-host &quot;Ending Call&quot;<br />&nbsp;&nbsp;&nbsp; #end the call<br />&nbsp;&nbsp;&nbsp; $message.Conversation.End()<br />}  <p>#########################################Main Script Code#########################################  <p>cls<br />write-host &quot;##################################################################&quot;<br />write-host &quot;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Welcome to the Automated Test Call Script&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&quot; <br />write-host &quot;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We will begin the sequence now&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&quot;<br />write-host &quot;##################################################################&quot;  <p>write-verbose &quot;check if the module is loaded&quot;<br />$module = get-module -Name &quot;Microsoft.Lync.Model&quot;  <p>#if module is not loaded check it exists and then load else exit<br />if ($module -eq 0)<br />{<br />&nbsp;&nbsp;&nbsp; Write-Verbose &quot;checking is assemblies are installed and at the correct path&quot;<br />&nbsp;&nbsp;&nbsp; $assemblyPath = &quot;C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll&quot;<br />&nbsp;&nbsp;&nbsp; $assemblyexist = test-path $assemblyPath<br />&nbsp;&nbsp;&nbsp; if ($assemblyPath -eq $false)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cls<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-Error -Message &quot;Lync SDK Not Detected Please Download it From <a href="https://www.microsoft.com/en-IE/download/details.aspx?id=36824&quot;">https://www.microsoft.com/en-IE/download/details.aspx?id=36824&quot;</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit 0<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-Verbose &quot;importing assembly&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Import-Module $assemblyPath<br />}  <p>#use [Microsoft.Lync.Model.ContactInformationType]:: Value here to get the contacttype field you want to use<br />#50 stands for SIP URI<br />$contacttype = 50  <p>#Get the client instance we are working with this is the current process lync is operating under<br />$client = [Microsoft.Lync.Model.LyncClient]::GetClient()<br />#we start to build a conversation here in an inactive state and we can add stuff to it  <p>Write-Verbose &quot;getting users from $inputfile&quot;<br />$users = get-content $inputfile<br />write-host &quot;Processing Users please be patient...&quot;<br />foreach ($User in $users)<br />{<br />&nbsp;&nbsp;&nbsp; Write-host &quot;Processing $User&quot;<br />&nbsp;&nbsp;&nbsp; $result = TestSipURI $user $client<br />}  <p>write-host &quot;Finished&quot;<br />write-host &quot;Please check $reportfile for all results&quot;</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>]]></content:encoded>
    </item>
  </channel>
</rss>