<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>DSC on But it works on my PC!</title>
    <link>https://blog.richardfennell.net/tags/dsc/</link>
    <description>Recent content in DSC on But it works on my PC!</description>
    <image>
      <title>But it works on my PC!</title>
      <url>https://blog.richardfennell.net/images/papermod-cover.png</url>
      <link>https://blog.richardfennell.net/images/papermod-cover.png</link>
    </image>
    <generator>Hugo -- 0.147.0</generator>
    <language>en</language>
    <lastBuildDate>Wed, 31 Jan 2018 12:33:16 +0000</lastBuildDate>
    <atom:link href="https://blog.richardfennell.net/tags/dsc/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>What I wish I had known when I started developing Lability DevTest Lab Environments</title>
      <link>https://blog.richardfennell.net/posts/what-i-wish-i-had-known-when-i-started-developing-lability-devtest-lab-environments/</link>
      <pubDate>Wed, 31 Jan 2018 12:33:16 +0000</pubDate>
      <guid>https://blog.richardfennell.net/posts/what-i-wish-i-had-known-when-i-started-developing-lability-devtest-lab-environments/</guid>
      <description>&lt;p&gt;At Black Marble we have been migrating our DevTest labs to from on-premises &lt;a href=&#34;https://blogs.blackmarble.co.uk/rfennell/2017/02/06/how-you-can-keep-using-lab-management-after-a-move-to-vsts-after-a-fashion/&#34;&gt;TFS Lab Management&lt;/a&gt; to a mixture of on-premise and Azure hosted &lt;a href=&#34;https://github.com/VirtualEngine/Lability&#34;&gt;Lability&lt;/a&gt; defined Labs &lt;a href=&#34;https://blogs.blackmarble.co.uk/rhepworth/2017/03/02/define-once-deploy-everywhere-sort-of/&#34;&gt;as discussed by Rik Hepworth on his blog&lt;/a&gt;. I have only been tangentially involved in this effort until recently, consuming the labs but not creating the definitions.&lt;/p&gt;
&lt;p&gt;So this post is one of those I do where I don’t want to forget things I learnt the hard way, or to put it another way asking &lt;a href=&#34;https://blogs.blackmarble.co.uk/rhepworth&#34;&gt;Rik&lt;/a&gt; or &lt;a href=&#34;https://chrislgardner.github.io/&#34;&gt;Chris&lt;/a&gt; after watching a 2 hour environment deploy fail for the Xth time.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>At Black Marble we have been migrating our DevTest labs to from on-premises <a href="https://blogs.blackmarble.co.uk/rfennell/2017/02/06/how-you-can-keep-using-lab-management-after-a-move-to-vsts-after-a-fashion/">TFS Lab Management</a> to a mixture of on-premise and Azure hosted <a href="https://github.com/VirtualEngine/Lability">Lability</a> defined Labs <a href="https://blogs.blackmarble.co.uk/rhepworth/2017/03/02/define-once-deploy-everywhere-sort-of/">as discussed by Rik Hepworth on his blog</a>. I have only been tangentially involved in this effort until recently, consuming the labs but not creating the definitions.</p>
<p>So this post is one of those I do where I don’t want to forget things I learnt the hard way, or to put it another way asking <a href="https://blogs.blackmarble.co.uk/rhepworth">Rik</a> or <a href="https://chrislgardner.github.io/">Chris</a> after watching a 2 hour environment deploy fail for the Xth time.</p>
<ul>
<li>
<p>You can’t log tool much. The log files are your friends, both the DSC ones and any generated by tools triggered by DSC. This is because most of the configuration process is done during boots so there is no UI to watch.</p>
</li>
<li>
<p>The DSC log is initially created in working folder the .MOF file is in on the target VM; but after a reboot (e.g. after joining a domain) the next and subsequent DSC log files are created in  <em>C:WindowsSystem32ConfigurationConfigurationStatus</em></p>
</li>
<li>
<p>Make sure you specify the full path for any bespoke logging you do, relative paths make it too easy to lose the log file</p>
</li>
<li>
<p>Stupid typos get you every time, many will be spotted when the MOF file is generated, but too many such as ones in command lines or arguments are only spotted when you deploy an environment. Also too many of these don’t actually cause error messages, they just mean nothing happens. So if you expect a script/tool to be run and it doesn’t check the log and the definition for mismatches in names.</p>
</li>
<li>
<p>If you are using the <a href="https://docs.microsoft.com/en-us/powershell/dsc/packageresource">Package DSC Resource</a> to install an EXE or MSI couple of gotcha’s</p>
</li>
<li>
<p>For MSIs the <strong>ProductName</strong> parameter must exactly match the one in the MSI definition, and this <strong>must match</strong> the GUID <strong>ProductCode</strong>.  Both of these can be found using the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa370557%28v=vs.85%29.aspx">Orca tool</a></p>
<p><a href="https://blogs.blackmarble.co.uk/wp-content/uploads/sites/2/2018/01/image-3.png"><img alt="image" loading="lazy" src="https://blogs.blackmarble.co.uk/wp-content/uploads/sites/2/2018/01/image_thumb-3.png" title="image"></a></p>
</li>
</ul>
<pre tabindex="0"><code>Package MongoDb {

PsDscRunAsCredential = $DomainCredentialsAtDomain

DependsOn = &#39;\[Package\]VCRedist&#39;

Ensure = &#39;Present&#39;

Arguments = &#34;/qn /l\*v c:bootstrapMongoDBInstall.log INSTALLLOCATION=\`&#34;C:Program FilesMongoDBServer3.6\`&#34;&#34;

Name = &#34;MongoDB 3.6.2 2008R2Plus SSL (64 bit)&#34;

Path = &#34;c:bootstrapmongodb-win32-x86\_64-2008plus-ssl-3.6.2-signed.msi&#34;

ProductId = &#34;88B5F0D8-0692-4D86-8FF4-FB3CDBC6B40F&#34;

ReturnCode = 0

}


```*   For EXEs the ProductName does not appear to be as critical, but you still need the Product ID. You can get this with PowerShell on a machine that already has the EXE installed  
      
    
</code></pre><p>Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Version</p>
<pre tabindex="0"><code>
*   I had network issues, they could mostly be put does to incorrect [Network Address Translation](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network). In my case this should have been setup when Lability was initially configured, the commands ran OK creating a virtual switch and NetNat, but I ended up with a Windows failback network address of 169.x.x.x when I should have had an address of 192.168.x.x on my virtual switch. So if in doubt check the settings on your virtual switch, in the Windows ‘Networking and Share Center’ before you start doubting your environment definitions.

Hope these pointers help others, as well as myself, next time Lability definitions are written
</code></pre>]]></content:encoded>
    </item>
  </channel>
</rss>
