<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title> &#187; Joe</title>
	<atom:link href="http://risualblogs.com/blog/author/joeklimis/feed/" rel="self" type="application/rss+xml" />
	<link>http://risualblogs.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 18 May 2012 16:31:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>PowerShell string manipulation</title>
		<link>http://consulting.risualblogs.com/blog/2010/08/18/powershell-string-manipulation/</link>
		<comments>http://consulting.risualblogs.com/blog/2010/08/18/powershell-string-manipulation/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 23:01:16 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Regex]]></category>

		<guid isPermaLink="false">http://2.156</guid>
		<description><![CDATA[Whilst trying to automate some reporting automation and analysis , I overcome a requirement to reformat a csv ( loosest sense of the term) so that PowerShell will process it.  The following is a useful demonstration of how to manipulate text data and reformat it, also the use of regex (Regular Expression) in PowerShell to [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Whilst trying to automate some reporting automation and analysis , I overcome a requirement to reformat a csv ( loosest sense of the term) so that PowerShell will process it.  The following is a useful demonstration of how to manipulate text data and reformat it, also the use of regex (Regular Expression) in PowerShell to identify the current days file.</p>
<p>This has been tested against PowerShell 1.0 on Microsoft Windows Server 2003</p>
<blockquote><p><span style="color: #008000">##<br />
# A csv Files report is created but you are unable to load it as a csv File due to irregular  formatting of the report.<br />
# this will serve as a good example of string manipulation.<br />
#<br />
# Issues with csv file<br />
# remove top 6 lines, header information not required.<br />
# headers contain , but are not quoted, so you now have more columns than data<br />
# trailing , stop PowerShell loading csv as you can not have a blank header<br />
# the data is includes a % sign.  this then stop it being a number when imported into SQL / Excel<br />
#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
#<br />
#<br />
</span>$tmpfile    = &#8220;temp.csv&#8221;<br />
$mydat        = (get-date ((get-date).adddays(-1))-uformat &#8220;%Y%m%d&#8221;)    <span style="color: #008000"># get yesterdays date in the correct format<br />
</span>$filter        = [regex] &#8220;^Daily-View.*$mydat[0-9]{6}.csv$&#8221;            <span style="color: #008000"># Use regex to find today’s file</span><br />
$csvfile    = Get-ChildItem -Path &#8220;c:Joetest*.csv&#8221; | Where-Object {$_.Name -match $filter} # return 1 filename</p>
<p><span style="color: #008000">#              use PowerShell to drop the first 6 lines of unwanted text at the beginning of the file<br />
#</span><br />
$csvContent = get-content $csvfile</p>
<p>$csvContent | select -last ($csvContent.count -6) | Out-File $tmpfile</p>
<p><span style="color: #008000">#             replace &#8220;, %&#8221;   with  &#8221; %&#8221; <br />
#<br />
</span>$csvContent = &#8220;&#8221;<br />
$csvContent = get-content $tmpfile<br />
$csvContent[0] = $csvContent[0].replace(&#8220;, %&#8221;,&#8221; %&#8221;)</p>
<p><span style="color: #008000">#             remove trailing , on header line<br />
#<br />
</span>$csvContent[0] = $csvContent[0].substring(0,($csvContent[0].length)-1)     <span style="color: #008000"># remove the last char on the line </span></p>
<p><span style="color: #008000">#             remove all the &#8220;%&#8221; signs from the data  ( but not the header) <br />
# </span><br />
$counter = 0<br />
foreach ($line in $csvContent)<br />
{<br />
    if ($counter -ne 0)     <span style="color: #008000"># skip the header line<br />
</span>    {<br />
    $csvContent[$counter] =$csvContent[$counter].replace(&#8220;%&#8221;,&#8221;")<br />
    }<br />
$counter++<br />
}</p>
<p><span style="color: #008000">#            output the plain txt file<br />
#<br />
</span>$csvContent | out-file $tmpfile</p>
<p><span style="color: #008000">#             now you can import the file as a csv with no errors<br />
#<br />
</span>$csvdata = import-csv $tmpfile<br />
$csvdata</p>
<p><span style="color: #008000">#        &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
#         now you can do stuff with the data here<br />
#        &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; </span></p>
<p><span style="color: #008000">#         Remove old temp file<br />
#<br />
</span>if (test-path $tmpfile)<br />
    {<br />
        remove-item -path $tmpfile -force<br />
    }</p></blockquote>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://consulting.risualblogs.com/blog/2010/08/18/powershell-string-manipulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Virtual box 3.2.6  duplicate UUID Issue when copying disks files</title>
		<link>http://consulting.risualblogs.com/blog/2010/08/09/oracle-virtual-box-3-2-6-duplicate-uuid-issue-when-copying-disks-files/</link>
		<comments>http://consulting.risualblogs.com/blog/2010/08/09/oracle-virtual-box-3-2-6-duplicate-uuid-issue-when-copying-disks-files/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 10:39:18 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://2.150</guid>
		<description><![CDATA[I have built a new VM recently using VirtualBox and needed to use it as my base image, I stop the VM and copied the disk files to a new name and location. I then tried to create a new VM and attach the copied disk, only to get the following error “Failed to open [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have built a new VM recently using VirtualBox and needed to use it as my base image, I stop the VM and copied the disk files to a new name and location. I then tried to create a new VM and attach the copied disk, only to get the following error</p>
<p>“Failed to open the hard disk”</p>
<p>“Cannot register the hard disk ‘testdisk2.vdi’ with UUID {UUID} because a disk  ‘Testdisk1.vdi’ with {UUID} already exists in the media registry&#8221;”</p>
<p><a href="http://consulting.risualblogs.com/blog/files/2010/08/image.png"><img style="border: 0px" src="http://consulting.risualblogs.com/blog/files/2010/08/image_thumb.png" border="0" alt="image" width="244" height="225" /></a></p>
<p>The solution is to use the command line tool to clone the drive as follows:</p>
<p>open a command window (start &gt; Run &gt; cmd)</p>
<p>cd C:Program FilesOracleVirtualBox             (move to the program files folder)</p>
<p>VBoxManage.exe clonevdi “testdisk1.vdi” “f:VirtualBoxtestdisk2.vdi”</p>
<p>This will clone the drive to the new file and location which you can then use. This will need to be done for each subsequent copy.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://consulting.risualblogs.com/blog/2010/08/09/oracle-virtual-box-3-2-6-duplicate-uuid-issue-when-copying-disks-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 2008 R2 activation problem ( 0x8004FE2F , 0x8007232B on x64 servers)</title>
		<link>http://consulting.risualblogs.com/blog/2010/07/22/windows-2008-r2-activation-problem-0x8004fe2f-0x8007232b-on-x64-servers/</link>
		<comments>http://consulting.risualblogs.com/blog/2010/07/22/windows-2008-r2-activation-problem-0x8004fe2f-0x8007232b-on-x64-servers/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 22:16:06 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://2.141</guid>
		<description><![CDATA[Like the 100&#8242;s of times before,  you install Windows 2008 R2 on to a server , try activating it ,and get the error :- 0x8007232B – DNS name does not exist then you remember to set the proxy settings.. you open internet explorer and change the proxy settings , you can now browse the internet, [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Like the 100&#8242;s of times before,  you install Windows 2008 R2 on to a server , try activating it ,and get the error :-</p>
<p>0x8007232B – DNS name does not exist</p>
<p>then you remember to set the proxy settings.. you open internet explorer and change the proxy settings , you can now browse the internet,   and try activation again</p>
<p>but this time it still fails… that’s not supposed to happen, as you can access the web.  (also phone activation completely failed at this point too.)</p>
<p>This time it fails with code 0x8004FE2F</p>
<p>You find other blogs  on the internet, which suggest that its your proxy settings that have not been set,  and they are right but what they don’t tell you is <strong>specifically its Internet Explorer (64 bit) you need to set the proxy for.</strong> I had inadvertently set the IE (32 bit) settings previously.</p>
<p>Happy installations.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://consulting.risualblogs.com/blog/2010/07/22/windows-2008-r2-activation-problem-0x8004fe2f-0x8007232b-on-x64-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

