-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
42 lines (30 loc) · 8.53 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>/w21froster</title>
<subtitle>i post stuff</subtitle>
<link href="/atom.xml" rel="self"/>
<link href="http://w21froster.github.io/"/>
<updated>2017-08-17T18:51:07.330Z</updated>
<id>http://w21froster.github.io/</id>
<author>
<name>William Foster</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>New Blog</title>
<link href="http://w21froster.github.io/2017/08/16/New-Blog/"/>
<id>http://w21froster.github.io/2017/08/16/New-Blog/</id>
<published>2017-08-17T04:10:21.000Z</published>
<updated>2017-08-17T18:51:07.330Z</updated>
<content type="html"><![CDATA[<p><meta property="og:image" content="http://paralegalhell.com/wp-content/uploads/2011/08/new_blog_ad.jpg"><br><figure class="figure"><img src="http://paralegalhell.com/wp-content/uploads/2011/08/new_blog_ad.jpg" width="495" height="328"></figure><br>I have been thinking about creating a blog for some time and I finally got around to it. This content is hosted on a NodeJS platform called Hexo which serves static content. (Eg. I update it by writing pseudo-code and pushing updates to Github. Speaking of Github, they allow you to host a website as a subdomain for free to do whatever you like. (As long as it is tasteful…) You can even use it for monetary gains. At this time I have chosen not to do ads.</p>
<p>Anyways.</p>
<a id="more"></a>
<p>Here is a snippet of PowerShell code.</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># Import PowerCLI Modules</span></div><div class="line"><span class="built_in">Get-Module</span> –ListAvailable VM* | <span class="built_in">Import-Module</span></div><div class="line"></div><div class="line"><span class="comment"># Define Variables for Reference Image and Environment</span></div><div class="line"><span class="variable">$HostName</span> = <span class="string">"PO-INFR08.panoramaortho.com"</span></div><div class="line"><span class="variable">$REFVM</span> = <span class="string">"CAPTURE01"</span></div><div class="line"><span class="variable">$RAM</span> = <span class="number">4</span></div><div class="line"><span class="variable">$DISK</span> = <span class="number">200</span></div><div class="line"><span class="variable">$NETWORK</span> = <span class="string">"Bridged"</span></div><div class="line"><span class="variable">$DATASTORE</span> = <span class="string">""</span></div><div class="line"><span class="variable">$ISO</span> = <span class="string">"[vmware-isos] MS WorkStation OS\Win 7\LiteTouchPE_x64.iso"</span></div><div class="line"><span class="variable">$SMTPServer</span> = <span class="string">""</span></div><div class="line"><span class="variable">$VMSearch</span> = <span class="variable">$REFVM</span></div><div class="line"><span class="variable">$VMHost</span> = <span class="string">""</span></div><div class="line"><span class="variable">$FROM</span> = <span class="string">"wf_admin@testdomain.com"</span></div><div class="line"><span class="variable">$TO</span> = <span class="string">"myemail"</span></div><div class="line"></div><div class="line"><span class="comment"># Connect to VSphere</span></div><div class="line">Connect-VIServer <span class="variable">$HostName</span></div><div class="line"></div><div class="line"><span class="comment">#Remove any existing VM's with name matching in $REFVM</span></div><div class="line"><span class="keyword">If</span> ((Get-VM -Name <span class="variable">$REFVM</span> -ErrorAction SilentlyContinue).PowerState <span class="nomarkup">-eq</span> <span class="string">"PoweredOn"</span>) {</div><div class="line"> <span class="built_in">Send-MailMessage</span> -SmtpServer <span class="variable">$SMTPServer</span> -From <span class="variable">$FROM</span> -To <span class="variable">$TO</span> `</div><div class="line"> -Subject <span class="string">"Reference Image creation previous attempt failed"</span> `</div><div class="line"> -Body <span class="string">"Something went wrong with the last reference image capture process.`</span></div><div class="line"><span class="string"> Please connect to <span class="variable">$REFVM</span> on <span class="variable">$HostName</span> and solve any issues."</span> </div><div class="line"> <span class="keyword">Exit</span></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">Else</span> {</div><div class="line"> Remove-VM -VM <span class="variable">$REFVM</span> -Server <span class="variable">$HostName</span> -DeleteFromDisk -Confirm:<span class="literal">$false</span></div><div class="line">}</div><div class="line"></div><div class="line"><span class="comment">#Create a new VM with specified configuration</span></div><div class="line">New-VM -Name <span class="variable">$REFVM</span> -Datastore <span class="variable">$DATASTORE</span> -DiskGB <span class="variable">$DISK</span> -DiskStorageFormat Thin -MemoryGB <span class="variable">$RAM</span> `</div><div class="line"> -GuestId windows7_64Guest -NumCpu <span class="number">2</span> -VMHost <span class="variable">$VMHost</span></div><div class="line">New-CDDrive -VM <span class="variable">$REFVM</span> -IsoPath <span class="variable">$ISO</span> -StartConnected:<span class="literal">$true</span> -Confirm:<span class="literal">$false</span></div><div class="line">Get-NetworkAdapter -VM <span class="variable">$REFVM</span> | Set-NetworkAdapter -StartConnected:<span class="literal">$true</span> -NetworkName <span class="string">"VM Network"</span> -Confirm:<span class="literal">$false</span></div><div class="line"></div><div class="line"><span class="comment">#Start VM</span></div><div class="line">Start-VM -VM <span class="variable">$REFVM</span> -Confirm:<span class="literal">$false</span></div><div class="line"></div><div class="line"><span class="comment">#Email informing that the reference image creation has begun as scheduled</span></div><div class="line"><span class="built_in">Send-MailMessage</span> -SmtpServer <span class="variable">$SMTPServer</span> -From <span class="variable">$FROM</span> -To <span class="variable">$TO</span> `</div><div class="line"> -Subject <span class="string">"Reference Image creation has begun"</span> `</div><div class="line"> -Body <span class="string">"Please monitor for an email in about 2-3 hours to signal that the image has been created."</span></div></pre></td></tr></table></figure>
]]></content>
<summary type="html">
<p><meta property="og:image" content="http://paralegalhell.com/wp-content/uploads/2011/08/new_blog_ad.jpg"><br><img src="http://paralegalhell.com/wp-content/uploads/2011/08/new_blog_ad.jpg" width="495" height="328"><br>I have been thinking about creating a blog for some time and I finally got around to it. This content is hosted on a NodeJS platform called Hexo which serves static content. (Eg. I update it by writing pseudo-code and pushing updates to Github. Speaking of Github, they allow you to host a website as a subdomain for free to do whatever you like. (As long as it is tasteful…) You can even use it for monetary gains. At this time I have chosen not to do ads.</p>
<p>Anyways.</p>
</summary>
</entry>
</feed>