<?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>Marc Valk dot NetMarc Valk dot Net</title>
	<atom:link href="http://www.marcvalk.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcvalk.net</link>
	<description>Just Another Blog</description>
	<lastBuildDate>Mon, 08 Apr 2013 09:29:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>See backup chain SQL Server</title>
		<link>http://www.marcvalk.net/2013/04/see-backup-chain-sql-server/</link>
		<comments>http://www.marcvalk.net/2013/04/see-backup-chain-sql-server/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 09:29:24 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1084</guid>
		<description><![CDATA[See the backup chain in SQL Server SELECT TOP 100 s.database_name, CASE s.type WHEN 'D' THEN 'Full' WHEN 'I' THEN 'Differential' WHEN 'L' THEN 'Transaction Log' END AS BackupType, CAST(DATEDIFF(second, s.backup_start_date, s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken, s.backup_start_date, CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn, CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn, m.physical_device_name, CAST(CAST(s.backup_size / 1000000 [...]]]></description>
				<content:encoded><![CDATA[<p>See the backup chain in SQL Server</p>
<div id="codeSnippetWrapper">
<div id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">SELECT</span> </pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">TOP</span> 100</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white">s.database_name,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">CASE</span> s.type</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">WHEN</span> <span style="color: #006080">'D'</span> <span style="color: #0000ff">THEN</span> <span style="color: #006080">'Full'</span></pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">WHEN</span> <span style="color: #006080">'I'</span> <span style="color: #0000ff">THEN</span> <span style="color: #006080">'Differential'</span></pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">WHEN</span> <span style="color: #006080">'L'</span> <span style="color: #0000ff">THEN</span> <span style="color: #006080">'Transaction Log'</span></pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">END</span> <span style="color: #0000ff">AS</span> BackupType,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">CAST</span>(DATEDIFF(<span style="color: #0000ff">second</span>, s.backup_start_date,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">s.backup_finish_date) <span style="color: #0000ff">AS</span> <span style="color: #0000ff">VARCHAR</span>(4)) + <span style="color: #006080">' '</span> + <span style="color: #006080">'Seconds'</span> TimeTaken,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white">s.backup_start_date,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">CAST</span>(s.first_lsn <span style="color: #0000ff">AS</span> <span style="color: #0000ff">VARCHAR</span>(50)) <span style="color: #0000ff">AS</span> first_lsn,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">CAST</span>(s.last_lsn <span style="color: #0000ff">AS</span> <span style="color: #0000ff">VARCHAR</span>(50)) <span style="color: #0000ff">AS</span> last_lsn,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">m.physical_device_name,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">CAST</span>(<span style="color: #0000ff">CAST</span>(s.backup_size / 1000000 <span style="color: #0000ff">AS</span> <span style="color: #0000ff">INT</span>) <span style="color: #0000ff">AS</span> <span style="color: #0000ff">VARCHAR</span>(14)) + <span style="color: #006080">' '</span> + <span style="color: #006080">'MB'</span> <span style="color: #0000ff">AS</span> bkSize,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">s.server_name,</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white">s.recovery_model</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">FROM</span> msdb.dbo.backupset s</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">INNER</span> <span style="color: #0000ff">JOIN</span> msdb.dbo.backupmediafamily m <span style="color: #0000ff">ON</span> s.media_set_id = m.media_set_id</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">WHERE</span> s.database_name = DB_NAME() <span style="color: #008000">-- Remove this line for all the database</span></pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"><span style="color: #0000ff">ORDER</span> <span style="color: #0000ff">BY</span> backup_start_date <span style="color: #0000ff">DESC</span>, backup_finish_date</pre>
<p><!--CRLF-->
<pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">GO</span></pre>
<p><!--CRLF--></div>
</div>
<p>Source: <a href="http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/">http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2013/04/see-backup-chain-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running PowerShell Script from Netlogon Share</title>
		<link>http://www.marcvalk.net/2013/04/running-powershell-script-from-netlogon-share/</link>
		<comments>http://www.marcvalk.net/2013/04/running-powershell-script-from-netlogon-share/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 06:17:34 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1082</guid>
		<description><![CDATA[To run a powershell script from a netlogon share, proceed as follows: create a batch file on the Netlogon Share call your PowerShell Script:powershell -executionpolicy bypass -file \\%userdomain%\netlogon\PS_login.ps1]]></description>
				<content:encoded><![CDATA[<p>To run a powershell script from a netlogon share, proceed as follows:</p>
<ul>
<li>create a batch file on the Netlogon Share</li>
<li>call your PowerShell Script:<br />powershell -executionpolicy bypass -file <a href="file://\\%userdomain%\netlogon\PS_login.ps1">\\%userdomain%\netlogon\PS_login.ps1</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2013/04/running-powershell-script-from-netlogon-share/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: updating AD photo for use in Office 365</title>
		<link>http://www.marcvalk.net/2013/03/powershell-updating-ad-photo-for-use-in-office-365/</link>
		<comments>http://www.marcvalk.net/2013/03/powershell-updating-ad-photo-for-use-in-office-365/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 13:34:31 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1066</guid>
		<description><![CDATA[I wanted to add a photo to every user in our Office 365 environment, so it is visible within our Lync software. Normally I would think I would go to Lync, open op &#8220;Tools&#8221; and then &#8220;Options&#8221;, select My Picture and change it. But in Lync 2013 the &#8220;Edit or Remove Picture&#8221; is grayed out. [...]]]></description>
				<content:encoded><![CDATA[<p>I wanted to add a photo to every user in our Office 365 environment, so it is visible within our Lync software.<br />
Normally I would think I would go to Lync, open op &#8220;Tools&#8221; and then &#8220;Options&#8221;, select My Picture and change it. But in Lync 2013 the &#8220;Edit or Remove Picture&#8221; is grayed out.<br />
You can read some more about this &#8220;problem&#8221; in <a title="Office 365 Community Support" href="http://community.office365.com/en-us/forums/166/t/81806.aspx" target="_blank">this </a>support post. It will be available again when they upgrade our office 365 environment.</p>
<p>So for now I had to think of something.<br />
As we have a synced environment (through DirSync) I thought I could make use of the AD User object property &#8220;ThumbnailPhoto&#8221;. If  I could fill this value with a jpg then it would get synced to office 365.<br />
And for that I created a PowerShell Script.</p>
<p>Starting Point: I have a folder with all the JPG images which are named in the following format firstname.lastname@domainname.jpg (I got these from someone else, who saved them like that). So as u will see in the script below I had to use some string manipulation to match the JPG to a domain user</p>
<pre>$photodir = "c:\temp\photo\"
$photos = Get-ChildItem -Path $photodir -Filter *.jpg

#itterate through Photos in Photo Directory
foreach ($photo in $photos)
{
	#store the raw file content of the image
	$jpg = [convert]::ToBase64String((get-content $photo.FullName -encoding byte))

	$Name = (($photo.Name).split("@")[0]).Replace("."," ")
	$LDAPString = "LDAP://cn=" + $Name + ",OU=OU1,dc=domain,dc=local"
	$userAD =  [adsi] $LDAPString
	$userAD.put("thumbnailPhoto",$jpg)
	$userAD.setinfo()
	Write-Host "Updated User " $userAD.name " Thumbnail Photo"
}</pre>
<p>It will take some time before you see pictures.</p>
<p>I received the following error for a few images: <em>Exception calling &#8220;setinfo&#8221; with &#8220;0&#8243; argument(s): &#8220;A constraint violation occurred. (Exception from HRESULT: 0x8007202F)&#8221;.</em></p>
<p>I noticed that the thumpnailphoto attribute can&#8217;t hold more than about 75kb. So make sure you&#8217;re images are smaller.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2013/03/powershell-updating-ad-photo-for-use-in-office-365/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Import Scheduled Task</title>
		<link>http://www.marcvalk.net/2013/02/powershell-import-scheduled-task/</link>
		<comments>http://www.marcvalk.net/2013/02/powershell-import-scheduled-task/#comments</comments>
		<pubDate>Thu, 14 Feb 2013 11:50:40 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1062</guid>
		<description><![CDATA[Some powershell I needed to import some scheduled tasks (xml files). Just for my own reference $XMLTaskDir = "C:\Program Files (x86)\****\***\" $Tasks = Get-ChildItem -Path $XMLTaskDir -Filter *.xml -Recurse foreach ($task in $tasks) { $TaskName = [io.path]::GetFileNameWithoutExtension($task) Register-ScheduledTask -Xml (get-content $task.FullName &#124; out-string) -TaskName $TaskName –User &#60;UserName&#62; –Password &#60;Password&#62; -taskpath Imported Disable-ScheduledTask -TaskName $TaskName -TaskPath [...]]]></description>
				<content:encoded><![CDATA[<p>Some powershell I needed to import some scheduled tasks (xml files).<br />
<em>Just for my own reference</em></p>
<pre>$XMLTaskDir = "C:\Program Files (x86)\****\***\"
$Tasks = Get-ChildItem -Path $XMLTaskDir -Filter *.xml -Recurse

foreach ($task in $tasks)
{
    $TaskName = [io.path]::GetFileNameWithoutExtension($task)
    Register-ScheduledTask -Xml (get-content $task.FullName | out-string) -TaskName $TaskName –User &lt;UserName&gt; –Password &lt;Password&gt; -taskpath Imported
    Disable-ScheduledTask -TaskName $TaskName -TaskPath Imported
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2013/02/powershell-import-scheduled-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server 2012 &#8211; installing Feature on Demand: .NET Framework 3.5</title>
		<link>http://www.marcvalk.net/2013/02/server-2012-installing-feature-on-demand-net-framework-3-5/</link>
		<comments>http://www.marcvalk.net/2013/02/server-2012-installing-feature-on-demand-net-framework-3-5/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 14:56:55 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[Windows Server]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1059</guid>
		<description><![CDATA[When installing SQL 2012 on my windows server 2012 box, I received errors about the install of .NET Framework 3.5.As .NET Framework 3.5 is a “feature on demand”, the binaries and other files associated with the feature are not included on the server. Windows Server tries to contact Windows Update to download the files it [...]]]></description>
				<content:encoded><![CDATA[<p>When installing SQL 2012 on my windows server 2012 box, I received errors about the install of .NET Framework 3.5.<br />As .NET Framework 3.5 is a “<a href="http://technet.microsoft.com/en-us/library/jj127275.aspx" target="_blank">feature on demand</a>”, the binaries and other files associated with the feature are not included on the server. Windows Server tries to contact Windows Update to download the files it needs to install the feature.<br />Your network configuration can have effect on the process of downloading the needed files.</p>
<p>I solved the problem, by mounting the Windows Server 2012 installation media and issuing the following command:</p>
<pre>Dism /online /enable-feature /featurename:NetFx3 /All /Source:<var>&lt;drive&gt;</var>:\sources\sxs /LimitAccess</pre>
<p>Where &lt;drive&gt; stands for the drive letter of the mounted installation media</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2013/02/server-2012-installing-feature-on-demand-net-framework-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing an Office 365 User Principal Name with Powershell</title>
		<link>http://www.marcvalk.net/2012/12/changing-a-office-365-user-principal-name-with-powershell/</link>
		<comments>http://www.marcvalk.net/2012/12/changing-a-office-365-user-principal-name-with-powershell/#comments</comments>
		<pubDate>Mon, 10 Dec 2012 07:53:38 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1054</guid>
		<description><![CDATA[It is very ease to change your login name in Office 365 if you have PowerShell for office 365 (x86 version, x64 Version) installed. First connect to Office 365 Connect-msolService Enter your Credentials, and then issue the next command: Set-MsolUserPrincipalName -NewUserPrincipalName [New Name] -UserPrincipalName [Old Name]]]></description>
				<content:encoded><![CDATA[<p>It is very ease to change your login name in Office 365 if you have PowerShell for office 365 (<a title="Download Powershell for Office 365 - 32 bits" href="http://go.microsoft.com/fwlink/p/?linkid=236298&amp;clcid=0x413">x86 version</a>, <a title="Download Powershell for Office 365 - 64 bits" href="http://go.microsoft.com/fwlink/p/?linkid=236297&amp;clcid=0x413">x64 Version</a>) installed.</p>
<p>First connect to Office 365
<pre>Connect-msolService
</pre>
<p>Enter your Credentials, and then issue the next command: </p>
<pre>Set-MsolUserPrincipalName -NewUserPrincipalName [New Name] -UserPrincipalName [Old Name] 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2012/12/changing-a-office-365-user-principal-name-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon Powershell Tools</title>
		<link>http://www.marcvalk.net/2012/12/amazon-powershell-tools/</link>
		<comments>http://www.marcvalk.net/2012/12/amazon-powershell-tools/#comments</comments>
		<pubDate>Fri, 07 Dec 2012 10:28:47 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1043</guid>
		<description><![CDATA[The amazon Powershell Tools have arrived: http://aws.amazon.com/powershell/578 commands When first starting your AWS Powershell Tools, you have to specify your Access Key and you Secret Access Key. They are then stored for future sessions.You can also create another set of stored Credentials. Set-AWSCredentials –AccessKey &#60;Your Access Key&#62; –Secretkey &#60;Your Secret Key&#62; –StoreAs SET1 SET1 is [...]]]></description>
				<content:encoded><![CDATA[<p>The amazon Powershell Tools have arrived: <a title="http://aws.amazon.com/powershell/" href="http://aws.amazon.com/powershell/">http://aws.amazon.com/powershell/</a><br />578 commands</p>
<p>When first starting your AWS Powershell Tools, you have to specify your Access Key and you Secret Access Key.</p>
<p><a href="http://www.marcvalk.net/wp-content/uploads/2012/12/image1.png" rel="lightbox[1043]"><img title="AWS PowerShell Tools" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="AWS PowerShell Tools" src="http://www.marcvalk.net/wp-content/uploads/2012/12/image_thumb1.png" width="260" height="176"></a></p>
<p>They are then stored for future sessions.<br />You can also create another set of stored Credentials.</p>
<pre>Set-AWSCredentials –AccessKey &lt;Your Access Key&gt; –Secretkey &lt;Your Secret Key&gt; –StoreAs SET1</pre>
<p>SET1 is a name you can give to identify your credentials<br />You can now load your &#8220;SET1&#8243; Credentials</p>
<pre>Set-AWSCredentials –StoredCredentials SET1</pre>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:47a864cc-4549-423f-936f-aee108ef4363" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">
<div><object width="448" height="252"><param name="movie" value="http://www.youtube.com/v/fGiYQtYcqCk?hl=en&amp;hd=1"></param><embed src="http://www.youtube.com/v/fGiYQtYcqCk?hl=en&amp;hd=1" type="application/x-shockwave-flash" width="448" height="252"></embed></object></div>
<div style="width:448px;clear:both;font-size:.8em">AWS Tools for PowerShell</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2012/12/amazon-powershell-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link: Where is the PowerShell ISE in Windows 8?</title>
		<link>http://www.marcvalk.net/2012/11/link-where-is-the-powershell-ise-in-windows-8/</link>
		<comments>http://www.marcvalk.net/2012/11/link-where-is-the-powershell-ise-in-windows-8/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 08:05:48 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=1032</guid>
		<description><![CDATA[http://www.trekker.net/archives/where-is-the-powershell-ise-in-windows-8/]]></description>
				<content:encoded><![CDATA[<p><a title="http://www.trekker.net/archives/where-is-the-powershell-ise-in-windows-8/" href="http://www.trekker.net/archives/where-is-the-powershell-ise-in-windows-8/">http://www.trekker.net/archives/where-is-the-powershell-ise-in-windows-8/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2012/11/link-where-is-the-powershell-ise-in-windows-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Counting Files older than today (little mistake)</title>
		<link>http://www.marcvalk.net/2012/06/powershell-counting-files-older-than-today-little-mistake/</link>
		<comments>http://www.marcvalk.net/2012/06/powershell-counting-files-older-than-today-little-mistake/#comments</comments>
		<pubDate>Fri, 15 Jun 2012 12:39:59 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=781</guid>
		<description><![CDATA[Today I had to count the number of XML files inside a folder. Simple, I thought. I created the following script: $OldestFileImport = get-childitem d: *.XML &#124; where-object {$_.LastWriteTime -le [datetime]::today} $OldestFileImport.count After executing it gave me an empty return (??). I was sure there was one older xml file in D:… So to test [...]]]></description>
				<content:encoded><![CDATA[<p>Today I had to count the number of XML files inside a folder.<br />
Simple, I thought.</p>
<p>I created the following script:</p>
<pre lang="powershell">$OldestFileImport = get-childitem d: *.XML | where-object {$_.LastWriteTime -le [datetime]::today}
$OldestFileImport.count</pre>
<p>After executing it gave me an empty return (??).<br />
I was sure there was one older xml file in D:… So to test again, I copied 15 other (older) XML files to D:. Executed the PowerShell and it gave me a count of 16.</p>
<p>What the……</p>
<p>After examining with <a href="http://powergui.org/index.jspa" target="_blank">Powergui</a> (long live powergui), I got to the answer.<br />
When there is more than one xml in D:, $oldestFileImport will be an array so you can use the method .count.<br />
If there is just one xml, it will return that one item (a FileSystem Object). So .count doesn’t work. To resolve it I had to add [array] to $OldestFileImport. So the complete script is:</p>
<pre lang="powershell">[array]$OldestFileImport = get-childitem d: *.XML | where-object {$_.LastWriteTime -le [datetime]::today}
$OldestFileImport.count</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2012/06/powershell-counting-files-older-than-today-little-mistake/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PowerShell: Moving files into subfolder based on date</title>
		<link>http://www.marcvalk.net/2012/06/powershell-moving-files-into-subfolder-based-on-date/</link>
		<comments>http://www.marcvalk.net/2012/06/powershell-moving-files-into-subfolder-based-on-date/#comments</comments>
		<pubDate>Thu, 14 Jun 2012 08:40:18 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/?p=778</guid>
		<description><![CDATA[A script to move files from one directory to another and ordering them in subdirectory in the destination folder. The subdirectory name is bases on the date of the file, thus ordering all files with the same date in the same subdirectory. In the example below, only the XML files will be moved $SourceDir = [...]]]></description>
				<content:encoded><![CDATA[<p>A script to move files from one directory to another and ordering them in subdirectory in the destination folder. The subdirectory name is bases on the date of the file, thus ordering all files with the same date in the same subdirectory. In the example below, only the XML files will be moved</p>
<pre lang="powershell" line="1">$SourceDir = "C:Folder1"
$DestinationDir = "D:Folder2"

$files = get-childitem $SourceDir *.xml
foreach ($file in $files) 
{
$Directory = $DestinationDir + "" + $file.CreationTime.Date.ToString('dd-MM-yyyy')
if (!(Test-Path $Directory))
	{
	New-Item $directory -type directory
	}
	Move-Item $file.fullname $Directory

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2012/06/powershell-moving-files-into-subfolder-based-on-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
