<?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>Xenophane&#039;s Blog</title>
	<atom:link href="http://www.xipher.dk/WordPress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.xipher.dk/WordPress</link>
	<description>Stuff that I do!</description>
	<lastBuildDate>Wed, 14 Mar 2012 20:50:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The mystery of why Cisco AnyConnect stopped working</title>
		<link>http://www.xipher.dk/WordPress/?p=674</link>
		<comments>http://www.xipher.dk/WordPress/?p=674#comments</comments>
		<pubDate>Wed, 14 Mar 2012 20:50:50 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Tech Stuff]]></category>
		<category><![CDATA[AnyConnect]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Intel]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=674</guid>
		<description><![CDATA[A while back I tried to update my Intel Centrino Ultimate 6300 Wifi NIC to the latest drivers, to test Intel MY wifi while I was out travelling, but I never got it to work, it said it could not detect a suitable adaptor.. So I did not think more of that, until I had [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=674">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>A while back I tried to update my Intel Centrino Ultimate 6300 Wifi NIC to the latest drivers, to test Intel MY wifi while I was out travelling, but I never got it to work, it said it could not detect a suitable adaptor.. So I did not think more of that, until I had to connect to our corporate network, using Cisco AnyConnect, and I got through both primary and secondary authentication fine, but then the connection crapped out with &#8220;unable to establish vpn&#8221;.. So after a few reboots and troubleshooting I ended up uninstalling the new driver, and reverting back to the old Lenovo one, I was running before.</p>
<p>Tonight I thought I would try again, to see if I could figure out what went wrong. So I installed the latest Intel drivers, and AnyConnect stopped working right away. So I went into Services to see what was &#8220;new&#8221; in there. I looked through all the Intel ones, and none of them looked &#8220;suspicious&#8221;, until I noticed that right below the Intel services, was &#8220;Internet Connnection Sharing (ICS)&#8221; and it was running. So I disabled it, and AnyConnected connected right away.</p>
<p>So if you have trouble connecting with AnyConnect, see if your connection has ICS enabled, or if you do not need it at all, just disable the service.</p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=674"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=674</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking Site sizes in SharePoint 2007 and 2010</title>
		<link>http://www.xipher.dk/WordPress/?p=669</link>
		<comments>http://www.xipher.dk/WordPress/?p=669#comments</comments>
		<pubDate>Wed, 25 Jan 2012 11:19:58 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=669</guid>
		<description><![CDATA[Our Sharepoint admin asked me to help him write a script, that found out how much space each DocumentLibrary in our sharepoint farm took up, so after some googeling I found that I could use the StorageManagementInformation Method on the SPSite object, so I cam up with this little script Seems as if I forgot [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=669">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>Our Sharepoint admin asked me to help him write a script, that found out how much space each DocumentLibrary in our sharepoint farm took up, so after some googeling I found that I could use the StorageManagementInformation Method on the SPSite object, so I cam up with this little script</p>
<pre class="brush: powershell; title: ; notranslate">
#First we load the SharePoint assembly
[void][System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.SharePoint&quot;)

#Then we create a function that returns tje SPSite
function Get-SPSite($url){
return new-Object Microsoft.SharePoint.SPSite($url)
}

$site = Get-SPSite http://URL
# We use the StorageManagementInformation Method on the $SPSite object, StorageManagementInformation returns a DataTable, and takes 4 input values
# System.Data.DataTable StorageManagementInformation(Microsoft.SharePoint.SPSite+StorageManagementInformationType ltVar, Microsoft.SharePoint.SPSite+StorageManagementSortOrder sordVar, Microsoft.SharePoint.SPSite+StorageManagementSortedOn soVar, System.UInt32 nMaxResults)
#
# ltVar: What kind of storage management information to display
#   List = 1
#   DocumentLibrary = 2
#   Document = 3
# sordVar: the direction in which the items are to be sorted
#   Increasing = 0×10
#   Decreasing = 0×11
# soVar: whether the items are sorted by size or by date
#   Size=0
#   Date = 1
# nMaxResults: the number of results to return

$DT = $site.StorageManagementInformation(2,0x11,0,$(($site.allwebs).count));
$DT | Select @{Label=&quot;Size&quot;; Expression={[INT]($_.Size/1MB)}},Directory  | out-gridview
$site.Dispose()
</pre>
<p>Seems as if I forgot the last line, where I dispose of the Site object, I have added that now.</p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=669"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=669</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating .Htacces file based on Apache log files</title>
		<link>http://www.xipher.dk/WordPress/?p=654</link>
		<comments>http://www.xipher.dk/WordPress/?p=654#comments</comments>
		<pubDate>Sun, 09 Oct 2011 18:12:12 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=654</guid>
		<description><![CDATA[I am still seeing massive amounts of referal traffic hitting my site, eating up my bandwidth.. I did not get time to update my .htaccess file for the last 2 days.. and within the last 24 hours I have had more than 6000 hits, generating in almost 24.000 pageviews&#8230; Generating more than 1 GB worth [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=654">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>I am still seeing massive amounts of referal traffic hitting my site, eating up my bandwidth.. I did not get time to update my .htaccess file for the last 2 days.. and within the last 24 hours I have had more than 6000 hits, generating in almost 24.000 pageviews&#8230; Generating more than 1 GB worth of traffic (So at that speed I will reach my 10 GB limit soon)</p>
<p>Looking through the Apache logs, figuring out which sites I get most referral traffic from, getting the hostnames, transforming them into a format that can be used by the Apache rewrite engine in the .htaccess file has been time consuming. So I decided that some powershell magic, might speed up the process a bit.</p>
<pre class="brush: powershell; title: ; notranslate">
function Select-FileDialog
{
	param(
		[string]$Title,
		[string]$Directory,
		[string]$Filter=&quot;All Files (*.*)|*.*&quot;)
			[System.Reflection.Assembly]::LoadWithPartialName(&quot;System.Windows.Forms&quot;) | Out-Null
			$objForm = New-Object System.Windows.Forms.OpenFileDialog
			$objForm.InitialDirectory = $Directory
			$objForm.Filter = $Filter
			$objForm.Title = $Title
			$Show = $objForm.ShowDialog()
				If ($Show -eq &quot;OK&quot;)
					{
						Return $objForm.FileName
					}
				Else
					{
					Write-Error &quot;Operation cancelled by user.&quot;
					}
}

#Function to create the http rewrite rules.

Function Create-Rewrite {
	Param (
			$Hostname
		  )

		$HtaRule = &quot;RewriteCond %{HTTP_REFERER} ^http://&quot; + &quot;$($hostname.replace(&quot;.&quot;,&quot;\.&quot;))&quot; +&quot; [OR]&quot;
		$script:BlockList += $HtaRule
}

Function add-htaccess {
	Param (
		$HtaRules
		)
	(Get-Content $htaccess) | foreach-object {
		$_
			if ($_ -match &quot;RewriteEngine&quot;) {
				if (!(Select-String -simplematch &quot;$htarules&quot; -Path $htaccess))
				{
				$HtaRules
				}
			 }

		} |	set-Content $tempFile
	Copy-Item $tempFile $htaccess
}

Function Upload-Ftp {
Param ([Parameter(Position=0, Mandatory=$true)]
		[ValidateNotNullOrEmpty()]
		[System.String]
		$FTPHost,
		[Parameter(Position=1)]
		[ValidateNotNull()]
		$File
		)
			$webclient = New-Object System.Net.WebClient
			$uri = New-Object System.Uri($ftphost)

			&quot;Uploading $File...&quot;

			$webclient.UploadFile($uri, $File)
		}

#Variables
$log = Select-FileDialog -Title &quot;Select an Apache logfile&quot;
$htaccess = &quot;c:\Temp\.htaccess&quot;
$tempFile = [IO.Path]::GetTempFileName()
$URLCount = 15
$FTPUsername = &quot;Username&quot;
$FTPPassword = &quot;PassW0rd&quot;

$BlockList = &quot;&quot;
#Create list of sites to block
$script:BlockList = @()

#Get the list of URLS in the the logfile, capturing each element into different named capturing groups

$urls = Select-String '^(?&lt;client&gt;\S+)\s+(?&lt;auth&gt;\S+\s+\S+)\s+\[(?&lt;datetime&gt;[^]]+)\]\s+&quot;(?:GET|POST|HEAD) (?&lt;file&gt;[^ ?&quot;]+)\??(?&lt;parameters&gt;[^ ?&quot;]+)? HTTP/[0-9.]+&quot;\s+(?&lt;status&gt;[0-9]+)\s+(?&lt;size&gt;[-0-9]+)\s+&quot;(?&lt;referrer&gt;[^&quot;]*)&quot;\s+&quot;(?&lt;useragent&gt;[^&quot;]*)&quot;$' $log |
     Select -Expand Matches | Foreach { $_.Groups[&quot;referrer&quot;].value } 

#Output statistics for the referer hostnames (Only show top 15)
$urls | group | ForEach -begin   { $total = 0 } `
	-process { $total += $_.Count; $_ } |Sort Count | Select Count, Name |
	Add-Member ScriptProperty Percent { &quot;{0,15:0.00}%&quot; -f (100*$this.Count/$Total) } -Passthru | select -Last $URLCount

#Getting the base hostnames from the complete URLS, and outputs statistics to the screen.

$hosts = $urls | Select-String '\b[a-z][a-z0-9+\-.]*://([a-z0-9\-._~%!$&amp;()*+,;=]+@)?(?&lt;host&gt;[a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&amp;()*+,;=:]+\])' |
Select -Expand Matches | Foreach { $_.Groups[&quot;host&quot;].value }  | group | sort count |  where {($_.name -notlike &quot;*xipher.dk*&quot;) -and ($_.Count -gt 100)} |
 ForEach -begin   { $total = 0 } `
	-process { $total += $_.Count; $_ } | Sort Count | Select Count, Name |
	Add-Member ScriptProperty Percent { &quot;{0,10:0.00}%&quot; -f (100*$this.Count/$Total) } -Passthru 

Write-Host &quot;List of root hostnames&quot;

$hosts

Foreach ($Url in $hosts) {

Create-Rewrite $url.Name
}

Foreach ($Block in $script:BlockList) {
add-htaccess $Block
}

notepad $htaccess

$script:BlockList

Upload-Ftp -FTPHost &quot;ftp://$($FTPUsername):$($FTPPassword)@xipher.dk/httpdocs/.htaccess&quot; -File $htaccess
Upload-Ftp -FTPHost &quot;ftp://$($FTPUsername):$($FTPPassword)@xipher.dk/httpdocs/WordPress/.htaccess&quot; -File $htaccess
</pre>
<p>Unfortunately my current hosting company, does not allow me to download the log files via FTP, but I have to connect to the Parallels interface and download it manually.. (I have not had the time looking into automating this part yet, so this is still a manual step)<br />
That is why I added a little function to use a GUI to pick the access_log file.</p>
<pre class="brush: powershell; title: ; notranslate">
function Select-FileDialog
{
	param(
		[string]$Title,
		[string]$Directory,
		[string]$Filter=&quot;All Files (*.*)|*.*&quot;)
			[System.Reflection.Assembly]::LoadWithPartialName(&quot;System.Windows.Forms&quot;) | Out-Null
			$objForm = New-Object System.Windows.Forms.OpenFileDialog
			$objForm.InitialDirectory = $Directory
			$objForm.Filter = $Filter
			$objForm.Title = $Title
			$Show = $objForm.ShowDialog()
				If ($Show -eq &quot;OK&quot;)
					{
						Return $objForm.FileName
					}
				Else
					{
					Write-Error &quot;Operation cancelled by user.&quot;
					}
}
</pre>
<p>I then call the function like this:</p>
<pre class="brush: powershell; title: ; notranslate">
$log = Select-FileDialog -Title &quot;Select an Apache logfile&quot;
</pre>
<p>A little Regex magic runs through the logfiles, and captures the different elements into different named capturing groups, in this step, I expand all referrer hostnames, and put them into the $urls variable</p>
<pre class="brush: powershell; title: ; notranslate">
$urls = Select-String '^(?&lt;client&gt;\S+)\s+(?&lt;auth&gt;\S+\s+\S+)\s+\[(?&lt;datetime&gt;[^]]+)\]\s+&quot;(?:GET|POST|HEAD) (?&lt;file&gt;[^ ?&quot;]+)\??(?&lt;parameters&gt;[^ ?&quot;]+)? HTTP/[0-9.]+&quot;\s+(?&lt;status&gt;[0-9]+)\s+(?&lt;size&gt;[-0-9]+)\s+&quot;(?&lt;referrer&gt;[^&quot;]*)&quot;\s+&quot;(?&lt;useragent&gt;[^&quot;]*)&quot;$' $log |
     Select -Expand Matches | Foreach { $_.Groups[&quot;referrer&quot;].value }
</pre>
<p>I modified a script by Joel Bennet, to get a little statistics  as well, since there can be 1000&#8242;s of hostnames, I have selected only to output top 15 by default (using the $URLCount variable.</p>
<pre class="brush: powershell; title: ; notranslate">
$urls | group | ForEach -begin   { $total = 0 } `
	-process { $total += $_.Count; $_ } |Sort Count | Select Count, Name |
	Add-Member ScriptProperty Percent { &quot;{0,15:0.00}%&quot; -f (100*$this.Count/$Total) } -Passthru | select -Last $URLCount
</pre>
<p>Then I loop through all the hostnames, and extract the base domain name, using regex again. (Here I choose to ignore all traffic from my own domain name Xipher.dk, and I choose only to look for referral domains, that have generated 100 hits or more</p>
<pre class="brush: powershell; title: ; notranslate">
$hosts = $urls | Select-String '\b[a-z][a-z0-9+\-.]*://([a-z0-9\-._~%!$&amp;()*+,;=]+@)?(?&lt;host&gt;[a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&amp;()*+,;=:]+\])' |
Select -Expand Matches | Foreach { $_.Groups[&quot;host&quot;].value }  | group | sort count |  where {($_.name -notlike &quot;*xipher.dk*&quot;) -and ($_.Count -gt 100)} |
 ForEach -begin   { $total = 0 } `
	-process { $total += $_.Count; $_ } | Sort Count | Select Count, Name |
	Add-Member ScriptProperty Percent { &quot;{0,10:0.00}%&quot; -f (100*$this.Count/$Total) } -Passthru
</pre>
<p>The script expects to find a .htaccess file in c:\temp containing at least the following two lines:</p>
<p>RewriteEngine On<br />
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]</p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=654"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=654</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally got confirmation.. Grown men do cry when their Bitlocker encrypted SSD disk dies ;(</title>
		<link>http://www.xipher.dk/WordPress/?p=651</link>
		<comments>http://www.xipher.dk/WordPress/?p=651#comments</comments>
		<pubDate>Sun, 18 Sep 2011 17:57:05 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=651</guid>
		<description><![CDATA[Had another visit from the ever present Mr Murphy, I have had a Lenovo T420 sitting on my desk for a while, as a replacement for my T410.. Finally last night I had some time to start moving over data to the new laptop. So I boot up both laptops, both have Windows Updates ready [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=651">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>Had another visit from the ever present Mr Murphy, I have had a Lenovo T420 sitting on my desk for a while, as a replacement for my T410.. Finally last night I had some time to start moving over data to the new laptop. So I boot up both laptops,  both have Windows Updates ready to install.. So I thought, I might as well, let it update, while I went out to get me something to drink. When I get back, my &#8220;old&#8221; laptop would&#8217;nt boot.. The SSD disk had suddenly stopped working.  Even after 1 day at work, I have found that I have a lot of ad-hoc scripts, that I had not backed up&#8230; I am going on 7 weeks paternity leave next friday, so I had written a bunch of documentation, for my colleagues to have..</p>
<p>So sorry to all those people I have made fun of over time, for having elaborate backup solutions for their laptops  <img src='http://www.xipher.dk/WordPress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=651"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=651</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to my old theme again</title>
		<link>http://www.xipher.dk/WordPress/?p=648</link>
		<comments>http://www.xipher.dk/WordPress/?p=648#comments</comments>
		<pubDate>Mon, 05 Sep 2011 09:34:22 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=648</guid>
		<description><![CDATA[Updated my .htaccess file to prevent the massive flooding of my site..]]></description>
			<content:encoded><![CDATA[<p>Updated my .htaccess file to prevent the massive flooding of my site.. </p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=648"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=648</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing simple theme</title>
		<link>http://www.xipher.dk/WordPress/?p=645</link>
		<comments>http://www.xipher.dk/WordPress/?p=645#comments</comments>
		<pubDate>Fri, 02 Sep 2011 10:45:34 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=645</guid>
		<description><![CDATA[I am currently having some problems with my site, apparently it gets linked to be a lot of spam sites, resulting in more than 4000 visits in the last 24 hours. These &#8220;visitors&#8221; have generated over 1GB worth of traffic, and there is a 10GB cap on my current account.. So that this rate my [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=645">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>I am currently having some problems with my site, apparently it gets linked to be a lot of spam sites, resulting in more than 4000 visits in the last 24 hours. These &#8220;visitors&#8221; have generated over 1GB worth of traffic, and there is a 10GB cap on my current account.. So that this rate my site will be closed in 10 days  <img src='http://www.xipher.dk/WordPress/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=645"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=645</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix 2008R2 scheduled tasks</title>
		<link>http://www.xipher.dk/WordPress/?p=633</link>
		<comments>http://www.xipher.dk/WordPress/?p=633#comments</comments>
		<pubDate>Fri, 17 Jun 2011 19:29:00 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=633</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: powershell; title: ; notranslate">
Function Change-ScheduledTask {
Param($XMLIn)
$ShortDate = [regex]&quot;(?&lt;shortdate&gt;[0-9]{4}[/.-](?:1[0-2]|0[1-9])[/.-](?:3[01]|[12][0-9]|0[1-9])T(?:2[0-3]|[01][0-9])[:.][0-5][0-9][:.][0-5][0-9])(?&lt;digits&gt;\.\d*)&quot;

foreach ($line in $XMLIn){
If ($line -match &quot;$ShortDate&quot;) {
$line = [regex]::Replace($line, $ShortDate, $($Matches[&quot;Shortdate&quot;]))
}
$line
#$Script:outfile += $line + &quot;`n&quot;
}
}

Function Remove-ScheduledTask {

}

Function New-ScheduledTask {

}

$schtask = Schtasks.exe /query /s &quot;localhost&quot;  /V /FO CSV  | ConvertFrom-Csv

if ($schtask) {

Foreach ($sch in $schtask) {

if ($Sch.&quot;Run As User&quot; -like &quot;$($domainname)*&quot;) {
$sch
}
}

$outfile = &quot;&quot;
Change-scheduledtask $(Get-Content c:\temp\TestTask.xml)
</pre>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=633"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=633</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send SMS through bibob with Powershell</title>
		<link>http://www.xipher.dk/WordPress/?p=616</link>
		<comments>http://www.xipher.dk/WordPress/?p=616#comments</comments>
		<pubDate>Wed, 09 Feb 2011 20:55:42 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>
		<category><![CDATA[bibob]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=616</guid>
		<description><![CDATA[I thought I had posted this script more than a year ago, but apparently I have not. It is quite similar to the script, I posted recently sending SMS messages through unwire, this just allows bibob customers to send messages through bibobs online gateway. One thing to notice is that you are required to convert [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=616">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>I thought I had posted this script more than a year ago, but apparently I have not. It is quite similar to the script, I posted recently sending SMS messages through unwire, this just allows bibob customers to send messages through bibobs online gateway.</p>
<p>One thing to notice is that you are required to convert your password in an MD5 hash, before you send it. Here is a function to convert your plain passwords into an MD5 hash (Adapted from a script by Dennis Damen)</p>
<pre class="brush: powershell; title: ; notranslate">
Function New-MD5Hash {
	param(
		[Parameter(Position=0, Mandatory=$true)]
		[System.String]
		$inputString
		)
		$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
		$hashAlgorithm = new-object $cryptoServiceProvider
		$hashByteArray = $hashAlgorithm.ComputeHash($([Char[]]$inputString));
		foreach ($byte in $hashByteArray) { if ($byte -lt 16) {$result += “0{0:X}” -f $byte } else { $result += “{0:X}” -f $byte }}
write-host $result
}
</pre>
<p>Example of usage:
<pre><span style="color: #5F9EA0;">New-MD5Hash</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-inputString</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Pa$$W0rd1</span><span style="color: #800000;">"</span></pre>
<p>Here is the bibob send sms script.</p>
<pre class="brush: powershell; title: ; notranslate">
&lt;#
	.SYNOPSIS
		Send SMS through Bibob (Danish mobile phone company)

	.DESCRIPTION
		Send SMS Text messages through bibob SMS Gateway services

	.PARAMETER  Content
		The text that the message should contain (Strings above 160 Chars will be split) [Mandatory]

	.PARAMETER  Recipient
		The recipient phonenumber (8 digits) [Mandatory]

	.EXAMPLE
		PS C:\&gt;Send-SMS -Content &quot;Hello handsome&quot; -Recipient 42424242

	.INPUTS
		System.String,System.Int32

	.OUTPUTS
		Sends SMS text message

	.NOTES

	.LINK
		about_functions_advanced

	.LINK
		about_comment_based_help

#&gt;

function Send-SMS {
	[CmdletBinding()]
	param(
		[Parameter(Position=0, Mandatory=$true)]
		[System.String]
		$Content= &quot;Hello Handsome&quot;,
		[Parameter(Position=1)]
		[System.Int32]
		$Recipient=42424242
	)
	begin {
		If ($Recipient -notmatch '^(\d{8})$' )
		{Write-Host &quot;Error in Phone Number&quot;
		break
		}
	$Username = &quot;42424242&quot; # The same as your login to bibob.dk (You cannot spoof you sender number, so it is used as sender as well)
	$MD5Password = &quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;

	}

	process {
$objHTTP = New-Object -ComObject MSXML2.XMLHTTP
$SoapServer = &quot;https://www.bibob.dk/SmsSender.asmx&quot; 

$XMLString = @&quot;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
&lt;soap:Body&gt;
&lt;SendMessage xmlns=&quot;http://www.bibob.dk/&quot;&gt;
&lt;cellphone&gt;$Username&lt;/cellphone&gt;
&lt;password&gt;$MD5Password&lt;/password&gt;
&lt;smsTo&gt;
&lt;string&gt;$recipient&lt;/string&gt;
&lt;/smsTo&gt;
&lt;smscontents&gt;$content&lt;/smscontents&gt;
&lt;fromNumber&gt;$username&lt;/fromNumber&gt;
&lt;/SendMessage&gt;
&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
&quot;@

$objHTTP.open('POST', $SoapServer, $False)

$objHTTP.setRequestHeader('Man', 'POST' + ' ' + $SoapServer + ' HTTP/1.1')
$objHTTP.setRequestHeader('Host', 'www.bibob.dk')
$objHTTP.setRequestHeader('Content-Type', 'text/xml; charset=utf-8')
$objHTTP.setRequestHeader('Content-Length', $($XMLString.Length))
$objHTTP.setRequestHeader('SOAPAction', 'http://www.bibob.dk/SendMessage')

$objHTTP.send($XMLString)
	}
}
</pre>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=616"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=616</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Send SMS from Powershell through Unwire</title>
		<link>http://www.xipher.dk/WordPress/?p=612</link>
		<comments>http://www.xipher.dk/WordPress/?p=612#comments</comments>
		<pubDate>Wed, 09 Feb 2011 13:38:39 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=612</guid>
		<description><![CDATA[At work we have bought an SMS gateway service through the danish company Unwire, so after we the deal was signed we got the information on how to send email through their services, so in order to test I wrote a quick Powershell script to test it. Of course all company/Unwire specific data has been [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=612">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>At work we have bought an SMS gateway service through the danish company Unwire, so after we the deal was signed we got the information on how to send email through their services, so in order to test I wrote a quick Powershell script to test it.</p>
<p>Of course all company/Unwire specific data has been removed, since it relates to our company account.</p>
<pre class="brush: powershell; title: ; notranslate">
&lt;#
	.SYNOPSIS
		Send SMS through Unwire GW Server

	.DESCRIPTION
		Send SMS Text messages through Unwire.com SMS Gateway services

	.PARAMETER  Content
		The text that the message should contain (Strings above 160 Chars will be split) [Mandatory]

	.PARAMETER  Recipient
		The recipient phonenumber (Either 8 or 10 digits) [Mandatory]

	.PARAMETER  Sender
		The name/number that shows up on the recipients phone (Maximum 11 digits/chars)

	.EXAMPLE
		PS C:\&gt;Send-SMS -Content &quot;Hello handsome&quot; -Recipient 42424242

	.EXAMPLE
		PS C:\&gt; Send-SMS -Content &quot;Hello handsome&quot; -Recipient 42424242 -Sender &quot;IT Helpdesk&quot;

	.INPUTS
		System.String,System.Int64,System.String

	.OUTPUTS
		Sends SMS text message

	.NOTES

	.LINK
		about_functions_advanced

	.LINK
		about_comment_based_help

#&gt;

function Send-SMS {
	[CmdletBinding()]
	param(
		[Parameter(Position=0, Mandatory=$true)]
		[System.String]
		$Content= &quot;Hello There&quot;,
		[Parameter(Position=1, Mandatory=$true)]
		[System.Int64]
		$Recipient=42424242,
		[Parameter(Position=2, Mandatory=$false)]
		[System.String]
		$Sender=&quot;IT-Drift&quot;
	)
	begin {

	If ( $Recipient -notmatch '^(\d{8}|\d{10})$' )
		{Write-Host &quot;Error in Phone Number&quot;
		break
		}
		If ($Sender.Length -gt 11)
		{Write-Host &quot;Sender name too long&quot;
		break
		}
	[Void] [System.Reflection.Assembly]::LoadWithPartialName(&quot;System.Web&quot;)
	$objHTTP = New-Object -ComObject MSXML2.XMLHTTP

	$User = &quot;xxxxx&quot;
	$Password = &quot;xxxxxx&quot;
	$AppNr = &quot;xxxxx&quot;
	$smsc = &quot;xxxxxx&quot;
	$Price = &quot;xxxxx&quot;

	$Message = [System.Web.HttpUtility]::UrlEncode([System.Text.Encoding]::GetEncoding(&quot;ISO-8859-1&quot;).GetBytes(&quot;$Content&quot;))
	$SenderName = [System.Web.HttpUtility]::UrlEncode([System.Text.Encoding]::GetEncoding(&quot;ISO-8859-1&quot;).GetBytes(&quot;$Sender&quot;))

[String] $unwireURL = &quot;xxxxxxxx&quot;
[String] $UnwireServer = &quot;xxxxxxxx&quot;
[String] $UnwireHost =&quot;xxxxxxxxxx&quot;

	}

	process {

$PushString = @&quot;
user=$user&amp;password=$password&amp;to=$Recipient&amp;text=$Message&amp;smsc=$smsc&amp;price=$Price&amp;type=text&amp;appnr=$AppNr&amp;from=$SenderName
&quot;@

$objHTTP.open('POST', $UnwireServer, $False)

$objHTTP.setRequestHeader('POST', $unwireURL  + ' HTTP/1.1')
$objHTTP.setRequestHeader('Host', $UnwireHost)
$objHTTP.setRequestHeader('User-Agent:', 'CP agent')
$objHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
$objHTTP.setRequestHeader('Content-Length', $($XMLString.Length))
$objHTTP.send(&quot;$PushString&quot;)
$objHTTP.status
$objHTTP.statusText

	}
}
</pre>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=612"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=612</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change username/password on scheduled tasks.</title>
		<link>http://www.xipher.dk/WordPress/?p=601</link>
		<comments>http://www.xipher.dk/WordPress/?p=601#comments</comments>
		<pubDate>Sat, 29 Jan 2011 22:01:48 +0000</pubDate>
		<dc:creator>Xenophane</dc:creator>
				<category><![CDATA[Everyday]]></category>

		<guid isPermaLink="false">http://www.xipher.dk/WordPress/?p=601</guid>
		<description><![CDATA[As stated in a previous post, I have been working on a script to change passwords on scheduled tasks. I had hoped to find some time to clean up the code, and write some error handling, but a few people asked for the code, so here it is in alpha alpha edition. ToDo: Tidy up [&#8230;] <a class="more-link" href="http://www.xipher.dk/WordPress/?p=601">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>As stated in a previous post, I have been working on a script to change passwords on scheduled tasks.</p>
<p>I had hoped to find some time to clean up the code, and write some error handling, but a few people asked for the code, so here it is in alpha alpha edition. </p>
<p>ToDo:   <br />Tidy up code    <br />Add some error handling    <br />Add code to update-scheduledtasks created in 2k8(R2) GUI</p>
<p>Description:</p>
<p>The script is assuming you have&#160; Powershell V2, and Quest AD cmdlets.</p>
<p>Here is a picture of the GUI when you run the script.</p>
<p>The Quest AD cmdlets are used to connect to AD, to get a list of computers to check for scheduled tasks</p>
<p><a href="http://www.xipher.dk/WordPress/wp-content/uploads/image12.png" rel="lightbox"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.xipher.dk/WordPress/wp-content/uploads/image_thumb12.png" width="244" height="162" /></a></p>
<p><strong>Search Account</strong>:&#160; Search for scheduled tasks running under the supplied account, you can use wildcards. If you supply DomainName\* (Default value), then it will search for scheduled tasks running under a domain account, you <strong>Search Root:</strong> The DN path from where you want to build your computer list</p>
<p>OSName: Default value is *server* it’s the value that is the same for all windows servers… So with this value set, it will only return servers from AD</p>
<p><strong>Filter MachineName: </strong>Default value is “*” which returns all servers,&#160; example “Exchan*” would return all servers whose names start with “Exchan”</p>
<p><strong>PassWord: </strong>Enter the new password for the scheduled tasks.</p>
<p>The Run scheduled tasks with current credentials is not working, since it is not supported against 2003 servers and below, so I remove the functionality.</p>
<p>&#160;</p>
<p>Here is an example of a result.</p>
<p><a href="http://www.xipher.dk/WordPress/wp-content/uploads/image16.png" rel="lightbox"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.xipher.dk/WordPress/wp-content/uploads/image_thumb16.png" width="244" height="77" /></a></p>
<p>You can click on one and edit the username if you like, otherwise you can just mark the ones you want to change password on, holding down ctrl and click each one.</p>
<p><a href="http://www.xipher.dk/WordPress/wp-content/uploads/image15.png" rel="lightbox"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.xipher.dk/WordPress/wp-content/uploads/image_thumb15.png" width="244" height="78" /></a></p>
<p>Press Change PWD</p>
<p>&#160;</p>
<p>As stated above, there is no particular error handling,and it takes a while to run depending on how many servers you have.&#160; (I hope to find some time to update the script, to a more “production” ready state soon)</p>
<pre class="brush: powershell; title: ; notranslate">
########################################################################
# Code Generated By: SAPIEN Technologies, Inc., PrimalForms 2009 v1.1.11.0
# Generated On: 29-01-2011 23:05
# Generated By: CTN
########################################################################

#----------------------------------------------
#region Application Functions
#----------------------------------------------

function OnApplicationLoad {
	#Note: This function runs before the form is created
	#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
	#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
	#Important: Form controls cannot be accessed in this function
	#TODO: Add snapins and custom code to validate the application load

	return $true #return true for success or false for failure
}

function OnApplicationExit {
	#Note: This function runs after the form is closed
	#TODO: Add custom code to clean up and unload snapins when the application exits

	$script:ExitCode = 0 #Set the exit code for the Packager
}

#endregion

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {

	#----------------------------------------------
	#region Import Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load(&quot;System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	[void][reflection.assembly]::Load(&quot;System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot;)
	[void][reflection.assembly]::Load(&quot;mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	[void][reflection.assembly]::Load(&quot;System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	#endregion

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object System.Windows.Forms.Form
	$progressbar1 = New-Object System.Windows.Forms.ProgressBar
	$label9 = New-Object System.Windows.Forms.Label
	$SchTaskPWD = New-Object System.Windows.Forms.TextBox
	$label8 = New-Object System.Windows.Forms.Label
	$button4 = New-Object System.Windows.Forms.Button
	$label7 = New-Object System.Windows.Forms.Label
	$SchTaskUsr = New-Object System.Windows.Forms.TextBox
	$button3 = New-Object System.Windows.Forms.Button
	$label6 = New-Object System.Windows.Forms.Label
	$srchMachineNameTXT = New-Object System.Windows.Forms.TextBox
	$label5 = New-Object System.Windows.Forms.Label
	$SrchOSNameTXT = New-Object System.Windows.Forms.TextBox
	$label4 = New-Object System.Windows.Forms.Label
	$SrchRootTXT = New-Object System.Windows.Forms.TextBox
	$label2 = New-Object System.Windows.Forms.Label
	$SrchAccountTxt = New-Object System.Windows.Forms.TextBox
	$label1 = New-Object System.Windows.Forms.Label
	$textbox1 = New-Object System.Windows.Forms.TextBox
	$button2 = New-Object System.Windows.Forms.Button
	$datagridview1 = New-Object System.Windows.Forms.DataGridView
	$button1 = New-Object System.Windows.Forms.Button
	$tooltip1 = New-Object System.Windows.Forms.ToolTip
	$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------

	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		$erroractionpreference = &quot;SilentlyContinue&quot;
		Add-PSSnapin *quest*
		$domainname = (Get-QADRootDSE).Domain.ToString()
		$SrchAccountTxt.Text = &quot;$domainname&quot; + &quot;*&quot;

		$SrchRootTXT.Text = (Get-QADRootDSE).DefaultNamingContextDN.ToString()
		$SrchOSNameTXT.Text = &quot;*Server*&quot;
		$srchMachineNameTXT.Text = &quot;*&quot;
		$SchTaskUsr.text = $env:userdomain + &quot;\&quot; + $env:username
		$array= new-object System.Collections.ArrayList
		$Tasks = @()

	}

	$handler_button1_Click={
	#TODO: Place custom script here

	$Servers = get-QADComputer -SearchRoot $SrchRootTXT.Text -OSName $SrchOSNameTXT.Text -Name $srchMachineNameTXT.Text # | where {$_.name -like $($srchMachineNameTXT.Text)}
	$progressbar1.Maximum = $Servers.Length

	Foreach ($server in $Servers ) {
	$serverFQDN = $server.dnsname

	$progressbar1.value += 1 

	$schtask = Schtasks.exe /query /s $serverFQDN  /V /FO CSV  | ConvertFrom-Csv
	#Write-Host &quot;****************** $($server.name)  Scheduled Tasks  ******************&quot;
	if ($schtask) {

	Foreach ($sch in $schtask) {
	#$Sch.&quot;Run As User&quot;
	if ($Sch.&quot;Run As User&quot; -like &quot;$($domainname)*&quot;) {
	#Write-Host  $serverFQDN    ($Sch.TaskName).replace(&quot;\&quot;,&quot;&quot;)    $Sch.'Run As User'

		$SchedTasks = New-Object System.Object
		$SchedTasks | Add-Member -type NoteProperty -name ServerName -value $serverFQDN
		$SchedTasks | Add-Member -type NoteProperty -name &quot;Scheduled Task&quot; -value ($Sch.TaskName).replace(&quot;\&quot;,&quot;&quot;)
		$SchedTasks | Add-Member -type NoteProperty -name NextRun  -value $Sch.'Next Run Time'
		$SchedTasks | Add-Member -type NoteProperty -name Username  -value $sch.'Run As User'
		$Tasks  += $SchedTasks
		$SchedTasks

	}

	}

	}

	}

	$array.AddRange($tasks)
	$datagridview1.DataSource = $array
	$datagridview1.AutoResizeColumns()

	}
	$handler_button2_Click={
		foreach ($row in $datagridview1.SelectedRows) {
		#[System.Windows.Forms.MessageBox]::Show($row.Cells[0].Value)
		$StrCmd = schtasks.exe /change /s &quot;$($row.Cells[0].Value)&quot; /RU &quot;$($row.Cells[3].Value)&quot; /RP &quot;$($textbox1.text)&quot; /TN &quot;`&quot;$($row.Cells[1].Value)`&quot;&quot;
			#Invoke-Expression $strCmd #|Out-File c:\temp\userlog.txt
			Write-Host $LastExitCode
			Write-Host $StrCmd
			Clear-Variable StrCmd -ErrorAction SilentlyContinue

		}

	}

	$handler_label1_Click={
	#TODO: Place custom script here

	}

	$handler_label2_Click={
	#TODO: Place custom script here

	}

	$handler_button3_Click={
	#TODO: Place custom script here
	if ($textbox1.PasswordChar -notlike &quot;`0&quot; ) {$textbox1.PasswordChar = $null ;$textBox1.Text = $textBox1.Text}
	else  {$textbox1.PasswordChar = &quot;*&quot;;$textBox1.Text = $textBox1.Text}

	}

	$handler_label7_Click={
	#TODO: Place custom script here

	}

	$handler_tooltip1_Popup=[System.Windows.Forms.PopupEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.PopupEventArgs]
	#TODO: Place custom script here

	}

	$ShowHelp={
	#TODO: Place custom script here
	#display popup help
	Switch ($this.name) {
	&quot;SrchAccountTxt&quot; {$tip=&quot;Examples: `n Domainname\AdminGuy Search for a specific account.`n DomainName\admin* For all usersnames in the domain that starts with admin `n Domainname\* All Domain users&quot;}
	&quot;SrchRootTXT&quot; {$tip=&quot;Enter DN for the OU, that you want to be the base of the AD search&quot;}
	&quot;SrchOSNameTXT&quot;  {$tip=&quot;Enter a complete or partial machinename that you want to search for. Wildcards are permitted `n Exhange* will find all servers whos name starts with 'Exchange'&quot;}
	default {$tip=&quot;No help found for $($this.name)&quot;}
	}
	$tooltip1.SetToolTip($this,$tip)

	}

	$handler_button4_Click={
	#TODO: Place custom script here
	if ($SchTaskPWD.PasswordChar -notlike &quot;`0&quot; ) {$SchTaskPWD.PasswordChar = $null ;$SchTaskPWD.Text = $SchTaskPWD.Text}
	else  {$SchTaskPWD.PasswordChar = &quot;*&quot;;$SchTaskPWD.Text = $SchTaskPWD.Text}
	}

	#----------------------------------------------
	# Generated Events
	#----------------------------------------------

	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# form1
	#
	$form1.Controls.Add($progressbar1)
	$form1.Controls.Add($label9)
	$form1.Controls.Add($SchTaskPWD)
	$form1.Controls.Add($label8)
	$form1.Controls.Add($button4)
	$form1.Controls.Add($label7)
	$form1.Controls.Add($SchTaskUsr)
	$form1.Controls.Add($button3)
	$form1.Controls.Add($label6)
	$form1.Controls.Add($srchMachineNameTXT)
	$form1.Controls.Add($label5)
	$form1.Controls.Add($SrchOSNameTXT)
	$form1.Controls.Add($label4)
	$form1.Controls.Add($SrchRootTXT)
	$form1.Controls.Add($label2)
	$form1.Controls.Add($SrchAccountTxt)
	$form1.Controls.Add($label1)
	$form1.Controls.Add($textbox1)
	$form1.Controls.Add($button2)
	$form1.Controls.Add($datagridview1)
	$form1.Controls.Add($button1)
	$form1.ClientSize = New-Object System.Drawing.Size(897,567)
	$form1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$form1.Name = &quot;form1&quot;
	$form1.Text = &quot;Change Scheduled Task Passwords v. 0.0.1&quot;
	$form1.add_Load($FormEvent_Load)
	#
	# progressbar1
	#
	$progressbar1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$progressbar1.Location = New-Object System.Drawing.Point(34,528)
	$progressbar1.Name = &quot;progressbar1&quot;
	$progressbar1.Size = New-Object System.Drawing.Size(829,23)
	$progressbar1.TabIndex = 23
	#
	# label9
	#
	$label9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label9.Location = New-Object System.Drawing.Point(505,98)
	$label9.Name = &quot;label9&quot;
	$label9.Size = New-Object System.Drawing.Size(108,23)
	$label9.TabIndex = 22
	$label9.Text = &quot;Schtasks Password&quot;
	#
	# SchTaskPWD
	#
	$SchTaskPWD.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$SchTaskPWD.Location = New-Object System.Drawing.Point(619,95)
	$SchTaskPWD.Name = &quot;SchTaskPWD&quot;
	$SchTaskPWD.PasswordChar = '*'
	$SchTaskPWD.Size = New-Object System.Drawing.Size(161,20)
	$SchTaskPWD.TabIndex = 21
	#
	# label8
	#
	$label8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label8.Location = New-Object System.Drawing.Point(505,64)
	$label8.Name = &quot;label8&quot;
	$label8.Size = New-Object System.Drawing.Size(108,23)
	$label8.TabIndex = 20
	$label8.Text = &quot;Schtasks username&quot;
	#
	# button4
	#
	$button4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$button4.Location = New-Object System.Drawing.Point(786,93)
	$button4.Name = &quot;button4&quot;
	$button4.Size = New-Object System.Drawing.Size(81,23)
	$button4.TabIndex = 19
	$button4.Text = &quot;Toggle PWD&quot;
	$button4.UseVisualStyleBackColor = $True
	$button4.add_Click($handler_button4_Click)
	#
	# label7
	#
	$label7.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label7.Location = New-Object System.Drawing.Point(506,36)
	$label7.Name = &quot;label7&quot;
	$label7.Size = New-Object System.Drawing.Size(218,23)
	$label7.TabIndex = 18
	$label7.Text = &quot;Run Schtasks with following credentials&quot;
	#
	# SchTaskUsr
	#
	$SchTaskUsr.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$SchTaskUsr.Location = New-Object System.Drawing.Point(619,63)
	$SchTaskUsr.Name = &quot;SchTaskUsr&quot;
	$SchTaskUsr.Size = New-Object System.Drawing.Size(161,20)
	$SchTaskUsr.TabIndex = 17
	#
	# button3
	#
	$button3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$button3.Location = New-Object System.Drawing.Point(439,123)
	$button3.Name = &quot;button3&quot;
	$button3.Size = New-Object System.Drawing.Size(79,23)
	$button3.TabIndex = 16
	$button3.Text = &quot;Toggle PWD&quot;
	$button3.UseVisualStyleBackColor = $True
	$button3.add_Click($handler_button3_Click)
	#
	# label6
	#
	$label6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label6.Location = New-Object System.Drawing.Point(169,92)
	$label6.Name = &quot;label6&quot;
	$label6.Size = New-Object System.Drawing.Size(106,23)
	$label6.TabIndex = 15
	$label6.Text = &quot;Filter MachineName&quot;
	#
	# srchMachineNameTXT
	#
	$srchMachineNameTXT.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$srchMachineNameTXT.Location = New-Object System.Drawing.Point(284,92)
	$srchMachineNameTXT.Name = &quot;srchMachineNameTXT&quot;
	$srchMachineNameTXT.Size = New-Object System.Drawing.Size(148,20)
	$srchMachineNameTXT.TabIndex = 14
	#
	# label5
	#
	$label5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label5.Location = New-Object System.Drawing.Point(172,66)
	$label5.Name = &quot;label5&quot;
	$label5.Size = New-Object System.Drawing.Size(101,23)
	$label5.TabIndex = 13
	$label5.Text = &quot;OS Name&quot;
	#
	# SrchOSNameTXT
	#
	$SrchOSNameTXT.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$SrchOSNameTXT.Location = New-Object System.Drawing.Point(284,66)
	$SrchOSNameTXT.Name = &quot;SrchOSNameTXT&quot;
	$SrchOSNameTXT.Size = New-Object System.Drawing.Size(148,20)
	$SrchOSNameTXT.TabIndex = 12
	#
	# label4
	#
	$label4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label4.Location = New-Object System.Drawing.Point(172,41)
	$label4.Name = &quot;label4&quot;
	$label4.Size = New-Object System.Drawing.Size(100,23)
	$label4.TabIndex = 11
	$label4.Text = &quot;SearchRoot &quot;
	#
	# SrchRootTXT
	#
	$SrchRootTXT.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$SrchRootTXT.Location = New-Object System.Drawing.Point(284,39)
	$SrchRootTXT.Name = &quot;SrchRootTXT&quot;
	$SrchRootTXT.Size = New-Object System.Drawing.Size(148,20)
	$SrchRootTXT.TabIndex = 10
	#
	# label2
	#
	$label2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label2.Location = New-Object System.Drawing.Point(172,14)
	$label2.Name = &quot;label2&quot;
	$label2.Size = New-Object System.Drawing.Size(100,23)
	$label2.TabIndex = 8
	$label2.Text = &quot;Search Accounts&quot;
	#
	# SrchAccountTxt
	#
	$SrchAccountTxt.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$SrchAccountTxt.Location = New-Object System.Drawing.Point(284,12)
	$SrchAccountTxt.Name = &quot;SrchAccountTxt&quot;
	$SrchAccountTxt.Size = New-Object System.Drawing.Size(148,20)
	$SrchAccountTxt.TabIndex = 7
	#
	# label1
	#
	$label1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label1.Location = New-Object System.Drawing.Point(172,124)
	$label1.Name = &quot;label1&quot;
	$label1.Size = New-Object System.Drawing.Size(100,23)
	$label1.TabIndex = 6
	$label1.Text = &quot;New Password&quot;
	#
	# textbox1
	#
	$textbox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$textbox1.Location = New-Object System.Drawing.Point(284,124)
	$textbox1.Name = &quot;textbox1&quot;
	$textbox1.PasswordChar = '*'
	$textbox1.Size = New-Object System.Drawing.Size(148,20)
	$textbox1.TabIndex = 5
	#
	# button2
	#
	$button2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$button2.Location = New-Object System.Drawing.Point(71,42)
	$button2.Name = &quot;button2&quot;
	$button2.Size = New-Object System.Drawing.Size(89,23)
	$button2.TabIndex = 4
	$button2.Text = &quot;Change PWD&quot;
	$button2.UseVisualStyleBackColor = $True
	$button2.add_Click($handler_button2_Click)
	#
	# datagridview1
	#
	$System_Windows_Forms_DataGridViewCellStyle_16 = New-Object System.Windows.Forms.DataGridViewCellStyle
	$System_Windows_Forms_DataGridViewCellStyle_16.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
	$System_Windows_Forms_DataGridViewCellStyle_16.BackColor = [System.Drawing.Color]::FromArgb(255,240,240,240)
	$System_Windows_Forms_DataGridViewCellStyle_16.Font = New-Object System.Drawing.Font(&quot;Microsoft Sans Serif&quot;,8.25,0,3,1)
	$System_Windows_Forms_DataGridViewCellStyle_16.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
	$System_Windows_Forms_DataGridViewCellStyle_16.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
	$System_Windows_Forms_DataGridViewCellStyle_16.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
	$System_Windows_Forms_DataGridViewCellStyle_16.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
	$datagridview1.ColumnHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_16
	$datagridview1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$System_Windows_Forms_DataGridViewCellStyle_17 = New-Object System.Windows.Forms.DataGridViewCellStyle
	$System_Windows_Forms_DataGridViewCellStyle_17.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
	$System_Windows_Forms_DataGridViewCellStyle_17.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
	$System_Windows_Forms_DataGridViewCellStyle_17.Font = New-Object System.Drawing.Font(&quot;Microsoft Sans Serif&quot;,8.25,0,3,1)
	$System_Windows_Forms_DataGridViewCellStyle_17.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
	$System_Windows_Forms_DataGridViewCellStyle_17.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
	$System_Windows_Forms_DataGridViewCellStyle_17.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
	$System_Windows_Forms_DataGridViewCellStyle_17.WrapMode = [System.Windows.Forms.DataGridViewTriState]::False
	$datagridview1.DefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_17
	$datagridview1.Location = New-Object System.Drawing.Point(34,165)
	$datagridview1.Name = &quot;datagridview1&quot;
	$System_Windows_Forms_DataGridViewCellStyle_18 = New-Object System.Windows.Forms.DataGridViewCellStyle
	$System_Windows_Forms_DataGridViewCellStyle_18.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
	$System_Windows_Forms_DataGridViewCellStyle_18.BackColor = [System.Drawing.Color]::FromArgb(255,240,240,240)
	$System_Windows_Forms_DataGridViewCellStyle_18.Font = New-Object System.Drawing.Font(&quot;Microsoft Sans Serif&quot;,8.25,0,3,1)
	$System_Windows_Forms_DataGridViewCellStyle_18.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
	$System_Windows_Forms_DataGridViewCellStyle_18.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
	$System_Windows_Forms_DataGridViewCellStyle_18.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
	$System_Windows_Forms_DataGridViewCellStyle_18.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
	$datagridview1.RowHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_18
	$datagridview1.Size = New-Object System.Drawing.Size(829,356)
	$datagridview1.TabIndex = 2
	#
	# button1
	#
	$button1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$button1.Location = New-Object System.Drawing.Point(71,12)
	$button1.Name = &quot;button1&quot;
	$button1.Size = New-Object System.Drawing.Size(89,23)
	$button1.TabIndex = 1
	$button1.Text = &quot;Get Servers&quot;
	$button1.UseVisualStyleBackColor = $True
	$button1.add_Click($handler_button1_Click)
	#
	# tooltip1
	#
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Show the Form
	return $form1.ShowDialog()

} #End Function

#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
	#Create the form
	GenerateForm | Out-Null
	#Perform cleanup
	OnApplicationExit
}
</pre>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://www.xipher.dk/WordPress/?p=601"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://www.xipher.dk/WordPress/?feed=rss2&#038;p=601</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

