<?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>Marcus Nyberg</title>
	<atom:link href="http://www.marcusnyberg.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcusnyberg.com</link>
	<description>Digital and dangerous</description>
	<lastBuildDate>Tue, 09 Mar 2010 12:22:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sending email in FreeBSD with Gmail</title>
		<link>http://www.marcusnyberg.com/2010/03/09/sending-email-in-freebsd-with-gmail/</link>
		<comments>http://www.marcusnyberg.com/2010/03/09/sending-email-in-freebsd-with-gmail/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:19:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[ssmtp]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=452</guid>
		<description><![CDATA[When I moved my mail functionality (gmail) from my FreeBSD-server to Google Apps I was left with no way to send email from my server (sendmail disabled and gmail removed) from shell. I have no longer the need  to recieve email from my server, thanks to Google! However, I needed to send emails from [...]]]></description>
			<content:encoded><![CDATA[<p>When I <a href="http://www.marcusnyberg.com/2008/12/30/flytt-av-mailhanteringen-till-google-apps/">moved my mail functionality</a> (gmail) from my FreeBSD-server to Google Apps I was left with no way to send email from my server (sendmail disabled and gmail removed) from shell. I have no longer the need  to recieve email from my server, thanks to Google! However, I needed to send emails from my server to report server status and report software/hardware errors. </p>
<p>This is how I solved the problem on my FreeBSD 7.0 server.</p>
<p>1. Freebsd has a guide for <a href="http://www.freebsd.org/doc/handbook/outgoing-only.html">setting up send only with ssmtp</a>. First you should install ssmtp.</p>
<p><code>cd /usr/ports/mail/ssmtp/ &#038;&#038; make install clean</code></p>
<p>2. Then you need to configure ssmtp for Gmail. Create this file in /usr/local/etc/ssmtp/ssmtp.conf. Replace email and password with your Gmail-account settings.</p>
<p><code>root=youremail@gmail.com<br />
mailhub=smtp.gmail.com:587<br />
AuthUser=youremail@gmail.com<br />
AuthPass=yourpassword<br />
UseSTARTTLS=YES</code></p>
<p>3. Test ssmtp. First you have to create a textfile with the message that you are going to send. Copy the text between the lines below.</p>
<p>Save the text to &#8221;testmessage.txt&#8221;.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
To: youremail@gmail.com<br />
From: youremail@gmail.com<br />
Subject: Testmessage</p>
<p>This is a test</code><br />
--------------------------</p>
<p>Then run this command to send the testmessage.</p>
<p><code>ssmtp -v youremail@gmail.com < testmessage.txt</code></p>
<p>You should see the following output:</p>
<p>[<-] 220 mx.google.com ESMTP 14sm2982172ewy.10<br />
[->] EHLO mysql<br />
[<-] 250 PIPELINING<br />
[->] STARTTLS<br />
[<-] 220 2.0.0 Ready to start TLS<br />
[->] EHLO servername<br />
[<-] 250 PIPELINING<br />
[->] AUTH LOGIN<br />
[<-] 334 VXNlcm5hbWU6<br />
[->] bWFyY3VzLm55YkBnbWFpbC5jb20=<br />
[<-] 334 UGFzc3dvcmQ6<br />
[<-] 235 2.7.0 Accepted<br />
[->] MAIL FROM:<root@mysql><br />
[<-] 250 2.1.0 OK 14sm2982172ewy.10<br />
[->] RCPT TO:<youremail@gmail.com><br />
[<-] 250 2.1.5 OK 14sm2982172ewy.10<br />
[->] DATA<br />
[<-] 354  Go ahead 14sm2982172ewy.10<br />
[->] Received: by Servername (sSMTP sendmail emulation); Tue, 09 Mar 2010 12:53:14 +0100<br />
[->] From: "Username" <username@servername><br />
[->] Date: Tue, 09 Mar 2010 12:53:14 +0100<br />
[->] To: youremail@gmail.com<br />
[->] Subject: Testmessage<br />
[->]<br />
[->] This is a test<br />
[->] .<br />
[<-] 250 2.0.0 OK 1268135596 14sm2982172ewy.10<br />
[->] QUIT<br />
[<-] 221 2.0.0 closing connection 14sm2982172ewy.10</p>
<p>If everything seems ok you should now have a fresh email in your Gmail account. Check it out! If not, then you should probably check your ssmtp.conf file and verify that you can connect to smtp.google.com</p>
<p>4. Last, replace sendmail with ssmtp. This makes ssmtp the default mailer for your system.</p>
<p><code>mv  /usr/sbin/sendmail  /usr/sbin/sendmail.org<br />
ln -s /usr/local/sbin/ssmtp /usr/sbin/sendmail</code></p>
<p>5. Check that mail is working.</p>
<p><code>mail -v -s "TestSubject" youremail@gmail.com<br />
Testing and<br />
.</code></p>
<p>Output:<br />
[<-] 220 mx.google.com ESMTP 16sm3004137ewy.7<br />
[->] EHLO mysql<br />
[<-] 250 PIPELINING<br />
[->] STARTTLS<br />
[<-] 220 2.0.0 Ready to start TLS<br />
[->] EHLO servername<br />
[<-] 250 PIPELINING<br />
[->] AUTH LOGIN<br />
[<-] 334 VXNlcm5hbWU6<br />
[->] bWFyY3VzLm55YkBnbWFpbC5jb20=<br />
[<-] 334 UGFzc3dvcmQ6<br />
[<-] 235 2.7.0 Accepted<br />
[->] MAIL FROM:<username@servername><br />
[<-] 250 2.1.0 OK 16sm3004137ewy.7<br />
[->] RCPT TO:<youremail@gmail.com><br />
[<-] 250 2.1.5 OK 16sm3004137ewy.7<br />
[->] DATA<br />
[<-] 354  Go ahead 16sm3004137ewy.7<br />
[->] Received: by mysql (sSMTP sendmail emulation); Tue, 09 Mar 2010 13:11:41 +0100<br />
[->] From: "Username" <username@servername><br />
[->] Date: Tue, 09 Mar 2010 13:11:41 +0100<br />
[->] To: youremail@gmail.com<br />
[->] Subject: TestSubject<br />
[->]<br />
[->] testing<br />
[->] .<br />
[<-] 250 2.0.0 OK 1268136703 16sm3004137ewy.7<br />
[->] QUIT<br />
[<-] 221 2.0.0 closing connection 16sm3004137ewy.7</p>
<p>6. Check the log file.</p>
<p><code>cat /var/log/maillog</code></p>
<p>Output:<br />
SMTP[755]: Creating SSL connection to host<br />
sSMTP[755]: SSL connection using RC4-MD5<br />
sSMTP[755]: Sent mail for username@servername(221 2.0.0 closing connection 14sm3068161ewy.2) uid=0 username=username outbytes=696<br />
sSMTP[1234]: Creating SSL connection to host<br />
sSMTP[1234]: SSL connection using RC4-MD5<br />
sSMTP[1234]: Sent mail for username@servername (221 2.0.0 closing connection 16sm3004137ewy.7) uid=0 username=username outbytes=349</p>
<p><strong>Summary</strong><br />
This worked for me straight out of the box. I didn't need to make any changes to make it work. I hope it works for you as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/03/09/sending-email-in-freebsd-with-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bygga egen spårsläde / spårdragare för längdåkning</title>
		<link>http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/</link>
		<comments>http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 18:25:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allmänt]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=412</guid>
		<description><![CDATA[Mitt senaste projekt var att tillverka en hemmagjord spårsläde för klassisk längdåkning som man kan dra efter en vanlig skoter. Det är perfekt att ha en egen spårmaskin en vinter som denna så att man kan dra upp egna skidspår. Efter att ha scannat av nätet för att se hur andra spårmaskiner är konstruerade så [...]]]></description>
			<content:encoded><![CDATA[<p>Mitt senaste projekt var att tillverka en hemmagjord spårsläde för klassisk längdåkning som man kan dra efter en vanlig skoter. Det är perfekt att ha en egen spårmaskin en vinter som denna så att man kan dra upp egna skidspår. Efter att ha scannat av nätet för att se hur andra spårmaskiner är konstruerade så fick jag en uppfattning om hur jag skulle bygga den. Alternativet hade varit att köpa en färdig släde för ett antal tusen kronor, men hur kul hade det varit&#8230;</p>
<p>Jag utgick från <a href="http://hem.passagen.se/pedahl/projekt.html">pedahls utmärkta spårsläde</a>. och hans utmärkta ritningar. Eftersom jag inte har några kunskaper om svetsning så tillverkade jag min i trä och plåt istället. Nackdelen med en sådan konstruktion är att det inte blir lika hållbart, men eftersom det är enkelt att tillverka nya &#8221;reservdelar&#8221; så gör ju inte det något. Det som kommer att slitas mest är skidorna som gör själva spåren. Släden kommer inte att användas dagligen så min konstruktion kommer att uppfylla mina behov. Pajar något så kommer det att vara enkelt att fixa.</p>
<p>Jag hittade alla delar hemma på gården och bygget gick smärtfritt. Några kreativa lösningar fick funderas fram men alla fick bitar fick sin plats till slut. Efter några rundor med den färdiga släden så kan jag konstatera att det blir väldigt fina skidspår av min enkla spårdragare. Beroende på snöförhållanden så kan jag lasta på olika tyngder för att spåraren ska kunna pressa undan snön bättre. Efter att jag gjort klar släden så har jag dragit upp ett spår på ca 2km.  Slutresultatet blev över alla förväntningar!</p>
<p>Här kommer några bilder på släden samt mina första spår:</p>

<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1654/' title='IMG_1654'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1654-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1654" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1655/' title='IMG_1655'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1655-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1655" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1656/' title='IMG_1656'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1656-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1656" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1657/' title='IMG_1657'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1657-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1657" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1658/' title='IMG_1658'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1658-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1658" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1659/' title='IMG_1659'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1659-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1659" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1660/' title='IMG_1660'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1660-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1660" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1661/' title='IMG_1661'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1661-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1661" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1664/' title='IMG_1664'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1664-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1664" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1665/' title='IMG_1665'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1665-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1665" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1668/' title='IMG_1668'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1668-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1668" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1669/' title='IMG_1669'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1669-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1669" /></a>
<a href='http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/img_1670/' title='IMG_1670'><img width="150" height="150" src="http://www.marcusnyberg.com/wp-content/uploads/2010/02/IMG_1670-150x150.jpg" class="attachment-thumbnail" alt="" title="IMG_1670" /></a>

<p>Film från första provturen:</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/BUGE80cBS7A&#038;hl=sv&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BUGE80cBS7A&#038;hl=sv&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Bygget</strong><br />
1. Jag började med att bygga stommen i trä. En platta i botten och sedan sarger runtom denna.<br />
2. Plåtskivan drogs sedan fast i trästommen.<br />
3. Tillverkade skidorna/medarna enligt pedahls profilritning och drog fast dessa i plåten och stommen.<br />
5. Byggde en enkel draganordning med ett armeringsjärn som böjdes till lämplig form. Ändarna fästes sedan i ett rör som dragits fast i trästommen.</p>
<p><strong>Material</strong><br />
* Plåt<br />
* Träbitar<br />
* Armeringsjärn<br />
* Rör<br />
* Skruv</p>
<p>Kostnad: 0 kr (hade alla bitar tillgängliga), men borde inte bli särskilt dyr med prylar från byggvaruhus.<br />
Tidsåtgång: 2-3 timmar</p>
<p><strong>Framtida förbättringar</strong><br />
* Att installera något som bryter upp snön framför skidorna.<br />
* Kanter på vardera sida i slädens riktning för att få släden att spåra mer rakt/stabilt.<br />
* Montera plåt på skidorna/medarna för bättre hållbarhet.</p>
<p><strong>Länkar</strong><br />
<a href="http://www.xcottawa.ca/articles.php?id=570">Build Your Own Cross-Country Ski Tracksetter for Grooming</a><br />
<a href="http://hem.passagen.se/pedahl/projekt.html">Pedahl spårmaskin</a><br />
<a href="http://www.timmshilltrail.com/grooming/grooming.htm">Tims National Trail Grooming</a></p>
<p><strong>Intressant läsning om spår och ledpreparering</strong><br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2010/02/Tracksetter.pdf'>Tracksetter</a><br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2010/02/SKI-TRAIL-GROOMING-GUIDE.pdf'>SKI TRAIL GROOMING GUIDE</a><br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2010/02/GUIDELINES-for-SNOWMOBILE-TRAIL-GROOMER-OPERATOR-TRAINING.pdf'>GUIDELINES for SNOWMOBILE TRAIL GROOMER OPERATOR TRAINING</a><br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2010/02/4.OPERATING-GROOMING-EQUIPMENT.pdf'>4.OPERATING GROOMING EQUIPMENT</a><br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2010/02/2.GROOMING-EQUIPMENT.pdf'>2.GROOMING EQUIPMENT</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/02/21/bygga-egen-sparslade-spardragare-for-langdakning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshoooting device driver installation with setupapilog.txt</title>
		<link>http://www.marcusnyberg.com/2010/01/22/troubleshoooting-device-driver-installation-with-setupapilog-txt/</link>
		<comments>http://www.marcusnyberg.com/2010/01/22/troubleshoooting-device-driver-installation-with-setupapilog-txt/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 13:40:39 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[WMI]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=402</guid>
		<description><![CDATA[Today I tried to install the &#8221;HP Universal Driver PCL6&#8243; (32-bit) on a Windows XP machine with WMI and VB.NET. All I got was the errorcode 2 and a failed installation. What does that mean? Windows errorcodes is not my (anyones?) speciality&#8230;
After some googling I found this very good post that describes the problem and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I tried to install the &#8221;HP Universal Driver PCL6&#8243; (32-bit) on a Windows XP machine with WMI and VB.NET. All I got was the errorcode 2 and a failed installation. What does that mean? Windows errorcodes is not my (anyones?) speciality&#8230;</p>
<p>After some googling I found this <a href="http://www.destiny-sys.com/wordpress/2009/05/23/troubleshooting-scripted-printer-driver-installations/">very good post</a> that describes the problem and a possible solution.</p>
<p>The key to solving this puzzle and possibly other device installation problems is the file <strong>setupapi.log</strong> in the windows folder. After running my code again I got this in my setupapi.log file (in swedish):</p>
<p><code>[SetupAPI Log]<br />
OS-version = 5.1.2600 Service Pack 3<br />
Plattforms-ID = 2 (NT)<br />
Service Pack = 3.0<br />
Svit = 0x0100<br />
Produkttyp = 1<br />
Arkitektur = 2006157608<br />
[2010/01/22 14:20:41 5392.4 Driver Install]<br />
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe<br />
#I060 Ange vald drivrutin.<br />
#I060 Ange vald drivrutin.<br />
[2010/01/22 14:20:41 5392.5]<br />
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe<br />
#-167 SPFILENOTIFY_NEEDMEDIA: Tagg = p6i2svww.cab, Beskrivning= PDL_LANG, Källsökväg = C:\CentralPrintArea\FKPrint\HP\Universal\32bit\HP Universal, Källfil = UNIDRV.HLP, Flaggor = 0x00000000.<br />
#E169 SPFILENOTIFY_NEEDMEDIA: returnerade FILEOP_ABORT. Fel 2: Det går inte att hitta filen.<br />
#W187 Installationen misslyckades. Försök att återställa originalfiler utförs.</code></p>
<p>It says that I got an errorcode 2 (missing file) and which file that is missing. In this case it is missing the file &#8221;UNIDRV.HLP&#8221; that is not available in swedish. All I had to do is to extract this file from the cab-file &#8221;p6i2svww.cab&#8221; to the root of the driverfolder. After doing this and running the program once more everything is working and the driver installs. After this I get the following output in <strong>setupapi.log</strong>.</p>
<p><code>[SetupAPI Log]<br />
OS-version = 5.1.2600 Service Pack 3<br />
Plattforms-ID = 2 (NT)<br />
Service Pack = 3.0<br />
Svit = 0x0100<br />
Produkttyp = 1<br />
Arkitektur = 2006157608<br />
[2010/01/22 14:28:43 4784.4 Driver Install]<br />
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe<br />
#I060 Ange vald drivrutin.<br />
#I060 Ange vald drivrutin.<br />
</code></p>
<p>That looks good I suppose! At least better then before. And the driver is installed ok!</p>
<p>You can <a href="http://www.microsoft.com/whdc/driver/install/setupapilog.mspx">read and download information about setupapilog.txt at the Microsoft website.</a> If you read the whitepaper you could possibly solve many kinds of STRANGE device driver installation problems.</p>
<p>This is Microsofts description of setupapilog.txt</p>
<blockquote><p>Windows XP and later versions log system operations more extensively than previous versions of Windows do. One of the most useful log files for debugging is the SetupAPI log file (setupapi.log). This plain-text file maintains the information that SetupAPI records about device installation, service-pack installation, and hotfix installation. Specifically, the file maintains a record of device and driver changes, as well as major system changes, </p></blockquote>
<p>If you wnat more verbose logging to the setupapi.txt file you can edit the windows registry key &#8221;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\LogLevel&#8221;. If you raise this value to 255 you get a lot of logging which can be useful at times.</p>
<p>I hope this helps someone and that HP fixes the broken driver. It must be some sort of localization problem within this driver. Or maybe that I have the wrong driver&#8230;</p>
<p>There is always something new to learn in the Windows world! Happy troubleshooting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/01/22/troubleshoooting-device-driver-installation-with-setupapilog-txt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a printerqueu with .NET and WMI</title>
		<link>http://www.marcusnyberg.com/2010/01/12/how-to-create-a-printerqueu-with-net-and-wmi/</link>
		<comments>http://www.marcusnyberg.com/2010/01/12/how-to-create-a-printerqueu-with-net-and-wmi/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 11:33:22 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=392</guid>
		<description><![CDATA[This is an example of how you create a printerqueue with .NET and WMI (Windows Management Instrumentation).  
A list of properties can be found at MSDN Win32_Printer
Other topics:
How to install printerdrivers with wmi and VB.NET
How to create TCP/IP printerports with .NET

Imports System.Management

Dim shared as Boolean = true

Try
 Dim mp As ManagementPath = New ManagementPath("Win32_Printer")
 [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example of how you create a printerqueue with .NET and WMI (Windows Management Instrumentation).  </p>
<p>A list of properties can be found at <a href="http://msdn.microsoft.com/en-us/library/aa394363%28VS.85%29.aspx">MSDN Win32_Printer</a></p>
<p>Other topics:<br />
<a href="http://www.marcusnyberg.com/2009/11/23/install-printerdrivers-wmi/">How to install printerdrivers with wmi and VB.NET</a><br />
<a href="http://www.marcusnyberg.com/2009/12/11/install-printerports-with-wmi-and-vb-net/">How to create TCP/IP printerports with .NET</a></p>
<pre name="code" class="vb.net">
Imports System.Management

Dim shared as Boolean = true

Try
 Dim mp As ManagementPath = New ManagementPath("Win32_Printer")
 Dim co As ConnectionOptions = New ConnectionOptions()
 co.EnablePrivileges = True
 co.Impersonation = ImpersonationLevel.Impersonate

 Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

 Dim printerObject As ManagementObject = New ManagementClass(ms, mp, Nothing).CreateInstance()
 printerObject("PortName") = "IP_192.168.0.2"
 printerObject("DriverName") = "DriverName"
 printerObject("DeviceID") = "queuename"
 printerObject("Location") = "Placement of printer"
 printerObject("Comment") = "Some comments"

 If (shared) Then
  printerObject("Shared") = True
  printerObject("ShareName") = "Sharename"
  'printerObject("Published") = False ' Publish printer
 End If

 Dim options As PutOptions = New PutOptions()
 options.Type = PutType.UpdateOrCreate
 printerObject.Put(options)

Catch ex As Exception
 ' Do something
End Try
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/01/12/how-to-create-a-printerqueu-with-net-and-wmi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nagios check_nt over ssh-tunnel</title>
		<link>http://www.marcusnyberg.com/2010/01/04/nagios-check_nt-over-ssh-tunnel/</link>
		<comments>http://www.marcusnyberg.com/2010/01/04/nagios-check_nt-over-ssh-tunnel/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 14:21:02 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=374</guid>
		<description><![CDATA[I am a big fan of Nagios for host and service monitoring and this is my first post on the subject. My task was to check services on a Windows Server with Nagios and NSClient++. But the firewall only allowed me to use ssh and thats why I could not connect to port 12489 (that [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big fan of <a href="http://www.nagios.org/">Nagios</a> for host and service monitoring and this is my first post on the subject. My task was to check services on a Windows Server with Nagios and <a href="http://nsclient.org/nscp/">NSClient++</a>. But the firewall only allowed me to use ssh and thats why I could not connect to port 12489 (that NSClient listens to) from my Nagios server. The only way to solve the problem was to use a <a href="http://www.marcusnyberg.com/2010/01/04/bash-script-that-open-and-close-an-ssh-tunnel-automagically/">SSH-tunnel that I can open and close</a> whenever I needed to.</p>
<p><strong>Workflow for my solution</strong><br />
1. Nagios initiates that a service should be checked.<br />
2. Nagios executes the check_nt_by_ssh_tunnel check-command with additional parameters<br />
3. The script creates a ssh-tunnel<br />
4. The script checks the Windows server with the Nagios builtin command check_nt<br />
5. The script returns the check_nt output<br />
6. The script closes the ssh-tunnel<br />
7. Nagios does its processing.</p>
<p><strong>Prerequisites</strong><br />
* A fully working Nagios installation<br />
* NSClient installed and working on the Windows Server that should be monitored<br />
* <a href="http://bloggerdigest.blogspot.com/2006/11/ssh-auto-login-or-passwordless-login.html">SSH autologin</a> is configured between the two machines<br />
* Read <a href="http://www.marcusnyberg.com/2010/01/04/bash-script-that-open-and-close-an-ssh-tunnel-automagically/">my other article</a> for details about the SSH-tunnel used in this solution.</p>
<p>First you have to create the check-script on the Nagios server (in the Nagios libexec-folder). See below:</p>
<p><strong>check_nt_by_ssh_tunnel.sh</strong></p>
<pre name="code" class="html">
#!/bin/bash

# $1 = HOSTNAME, 83.121.233.2
# $2 = LOCAL PORT, 14880
# $3 = USERNAME, ex: someusername
# $4 = CHECK PARAMETERS, ex: -w 80 -c 90 -v MEMUSE

if [ -z "$1" ]
then
        echo "Missing HOSTNAME"
        exit
fi

if [ -z "$2" ]
then
        echo "Missing LOCAL PORT"
        exit
fi

if [ -z "$3" ]
then
        echo "Missing USERNAME"
        exit
fi

# Open ssh-tunnel and wait for it to open
ssh -f -N -L $2:localhost:12489 $3@$1 &#038;
sleep 30

# Run check_nt command
CHECK="/usr/local/nagios/libexec/check_nt -H localhost -p $2 $4"
#echo $CHECK
eval $CHECK

# Close ssh-tunnel
sleep 5
CMD="ps -eo pid,args | grep 'ssh -f -N -L $2:localhost' | grep -v  'grep' | cut -c1-6"
#echo $CMD
PID=`eval $CMD`
#echo $PID
kill -9 $PID
</pre>
<p>Make it executable:<br />
chmod 755 check_nt_by_ssh_tunnel.sh</p>
<p>Then verify that i works by running the command:<br />
./check_nt_by_ssh_tunnel.sh 83.121.233.2 14880 someusername &#8221;-w 80 -c 90 -v MEMUSE&#8221;</p>
<p>You should then either see a valid Nagios plugin-output or get an error-message. Make sure that is works! You may have to modify the script depending on your *nix OS.</p>
<p>Next modify Nagios checkcommands.cfg or similiar and add the following. This makes the command available for use in Nagios.</p>
<pre name="code" class="html">
# USAGE: check_nt_by_ssh_tunnel!11101!username!"-l 5,80,90 -v CPULOAD"
define command{
	command_name		check_nt_by_ssh_tunnel
	command_line		PATH_TO_COMMAND/check_nt_by_ssh_tunnel.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}
</pre>
<p>Next add a service definition that uses the check-command.</p>
<pre name="code" class="html">
define service{
	use				       generic-service
        host_name                        MY_HOSTNAME
        service_description             Memory usage
        check_command                 check_nt_by_ssh_tunnel!11100!username!"-w 80 -c 90 -v MEMUSE"
}
</pre>
<p>The last step you need to do is to restart Nagios and check if it works.</p>
<p>* I recommend you to change the portnumber for each service-definition to avoid collisions. Make them unique to the service-check.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/01/04/nagios-check_nt-over-ssh-tunnel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash script that open and close an ssh-tunnel automagically</title>
		<link>http://www.marcusnyberg.com/2010/01/04/bash-script-that-open-and-close-an-ssh-tunnel-automagically/</link>
		<comments>http://www.marcusnyberg.com/2010/01/04/bash-script-that-open-and-close-an-ssh-tunnel-automagically/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 13:46:57 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=361</guid>
		<description><![CDATA[My problem was that I needed to connect to a port on a server that only was accessible by ssh. This connection should be made in a bash-script that starts and ends within a limited timeframe. That&#8217;s why I needed to solve the problem with a SSH-tunnel. George Notaras has made an article about auto-closing [...]]]></description>
			<content:encoded><![CDATA[<p>My problem was that I needed to connect to a port on a server that only was accessible by ssh. This connection should be made in a bash-script that starts and ends within a limited timeframe. That&#8217;s why I needed to solve the problem with a SSH-tunnel. George Notaras has made an article about <a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/">auto-closing ssh tunnels</a> that describes the problem and a solution that should work for most people. However, I did not need a auto-closing ssh tunnel because I want to close the tunnel whenever I want to. </p>
<p>My solution is a little bit more brute because it kills the tunnel. But hey, it works! Check out the simple solution below.</p>
<p><strong>Prerequisites</strong><br />
For this to work you need to have <a href="http://bloggerdigest.blogspot.com/2006/11/ssh-auto-login-or-passwordless-login.html">ssh auto login</a> between the two servers.</p>
<p>I have used this solution successfully with the Nagios monitoring system. Read <a href="http://www.marcusnyberg.com/2010/01/04/nagios-check_nt-over-ssh-tunnel/">Nagios check_nt over ssh-tunnel</a>.</p>
<pre name="code" class="html">
#!/bin/bash

# Open tunnel and wait for it to open
# 12489 = remote portnumber
# 3456  = local portnumber
# increase sleep-time if slow to connect
ssh -f -N -L 3456:localhost:12489 username@somehost &#038;
sleep 30

# Run some command that uses the opened tunnel
# telnet localhost 3456

# Close the tunnel by killing it
sleep 5
CMD="ps -eo pid,args | grep 'ssh -f -N -L 3456:localhost' | grep -v  'grep' | cut -c1-6"
#echo $CMD
PID=`eval $CMD`
#echo $PID
kill -9 $PID
</pre>
<p>You may have to change the parameters to the ps-command for this to work on your nix-machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/01/04/bash-script-that-open-and-close-an-ssh-tunnel-automagically/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install printerports with WMI and VB.NET</title>
		<link>http://www.marcusnyberg.com/2009/12/11/install-printerports-with-wmi-and-vb-net/</link>
		<comments>http://www.marcusnyberg.com/2009/12/11/install-printerports-with-wmi-and-vb-net/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 14:06:17 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[WMI]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=347</guid>
		<description><![CDATA[This is an example of how you install TCP/IP printerports with .NET and WMI (Windows Management Instrumentation).  
A list of properties can be found at MSDN Win32_TCPIPPrinterPort
Other topics:
How to install printerdrivers with wmi and VB.NET
How to create a printerqueu with .NET and WMI

Imports System.Management

Try
  Dim mp As ManagementPath = New ManagementPath("Win32_TCPIPPrinterPort")
  Dim [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example of how you install TCP/IP printerports with .NET and WMI (Windows Management Instrumentation).  </p>
<p>A list of properties can be found at <a href="http://msdn.microsoft.com/en-us/library/aa394492%28VS.85%29.aspx">MSDN Win32_TCPIPPrinterPort</a></p>
<p>Other topics:<br />
<a href="http://www.marcusnyberg.com/2009/11/23/install-printerdrivers-wmi/">How to install printerdrivers with wmi and VB.NET</a><br />
<a href="http://www.marcusnyberg.com/2010/01/12/how-to-create-a-printerqueu-with-net-and-wmi/">How to create a printerqueu with .NET and WMI</a></p>
<pre name="code" class="vb.net">
Imports System.Management

Try
  Dim mp As ManagementPath = New ManagementPath("Win32_TCPIPPrinterPort")
  Dim co As ConnectionOptions = New ConnectionOptions()
  co.EnablePrivileges = True

  Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

  Dim port As ManagementObject = New ManagementClass(ms, mp, Nothing).CreateInstance()
  port.SetPropertyValue("Name", "portname")
  port.SetPropertyValue("Protocol", 1)
  port.SetPropertyValue("HostAddress", "10.15.12.12")
  port.SetPropertyValue("PortNumber", "9100")

  Dim po As PutOptions = New PutOptions()
  po.UseAmendedQualifiers = True
  po.Type = PutType.UpdateOrCreate
  port.Put(po)
Catch ex As Exception
  ' do something
End Try
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/12/11/install-printerports-with-wmi-and-vb-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Marvel 6162 SATA driver for Windows 7</title>
		<link>http://www.marcusnyberg.com/2009/11/27/marvel-6162-sata-driver-for-windows-7/</link>
		<comments>http://www.marcusnyberg.com/2009/11/27/marvel-6162-sata-driver-for-windows-7/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 18:28:20 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=333</guid>
		<description><![CDATA[There isn&#8217;t any driver for the Marvel 6162 (88SE6162) SATA controller in Windows 7 (32-bit). For my motherboard (Asus M2V) I needed this driver and I could not find them on the Asus support website. I guess Asus havn&#8217;t made these available yet. Lazy bastards! After some modifications to the Vista-drivers I could use them [...]]]></description>
			<content:encoded><![CDATA[<p>There isn&#8217;t any driver for the Marvel 6162 (88SE6162) SATA controller in Windows 7 (32-bit). For my motherboard (Asus M2V) I needed this driver and I could not find them on the Asus support website. I guess Asus havn&#8217;t made these available yet. Lazy bastards! After some modifications to the Vista-drivers I could use them instead. </p>
<p><a href="http://www.marcusnyberg.com/wp-content/uploads/2009/11/marvel-6162-sata-driver.JPG"><img src="http://www.marcusnyberg.com/wp-content/uploads/2009/11/marvel-6162-sata-driver.JPG" alt="marvel-6162-sata-driver" title="marvel-6162-sata-driver" width="360" height="144" class="alignnone size-full wp-image-336" /></a></p>
<p>If you download and try to install the Vista-drivers you get a message like &#8221;Does not support this Operating System : WNT_6.1P_MCE&#8221;. To be able to run the installer you need to edit the AsusSetup.ini file with notepad. The only thing you need to do is add a line corresponding to your Operatingsystem (WNT_6.1P_MCE) in the [OS_Language_Tag] section of the file. </p>
<p>I have prepared a file for Windows 7 32-bit that you can use:<br />
<a href='http://www.marcusnyberg.com/wp-content/uploads/2009/11/Marvell_SATA_V10215B2.zip'>Download Marvell_SATA_V10215B2 driver</a>.</p>
<p>You only have to extract the files and run the AsusSetup file in the driver/x32 folder. If you run Windows 7 64-bit you can use the same files and make the same changes. If someone does this then please contribute to this post.</p>
<p>The driver installer then works great and the drivers are working. My SATA-drive has appeared and I am happy again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/11/27/marvel-6162-sata-driver-for-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem installing Windows 7 on Asus motherboards</title>
		<link>http://www.marcusnyberg.com/2009/11/27/problem-installing-windows-7-on-asus-motherboards/</link>
		<comments>http://www.marcusnyberg.com/2009/11/27/problem-installing-windows-7-on-asus-motherboards/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 22:08:06 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=331</guid>
		<description><![CDATA[For the last 5 hours I tried to install Windows 7 (x86, 32bit) on my home computer that has an Asus M2V motherboard. I tried everything in the book and couldn&#8217;t install it. I removed and switched hardware, reburned the DVD, updated the BIOS and did everything that I could possibly think of. The installation [...]]]></description>
			<content:encoded><![CDATA[<p>For the last 5 hours I tried to install Windows 7 (x86, 32bit) on my home computer that has an Asus M2V motherboard. I tried everything in the book and couldn&#8217;t install it. I removed and switched hardware, reburned the DVD, updated the BIOS and did everything that I could possibly think of. The installation process always hung when the installer says &#8221;expanding windows files&#8221;. No error messages or nothing and the installation percentage counter stops at a random number. That really pissed me of!</p>
<p>Finally I found an answer to this really weird behaviour. It seems that this is common problem on Asus motherboards and Windows 7.</p>
<p>In BIOS you have to make these changes to make it work:<br />
* Enable the floppy drive (I had it disabled because I dont have a floppy drive).<br />
* Disable the &#8221;Cool and quite&#8221; feature.</p>
<p>After I made these changes the installation worked!</p>
<p>I hope this helps other people stuck with the really annoying &#8221;Windows 7&#8243; installer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/11/27/problem-installing-windows-7-on-asus-motherboards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install printerdrivers with WMI and VB.NET</title>
		<link>http://www.marcusnyberg.com/2009/11/23/install-printerdrivers-wmi/</link>
		<comments>http://www.marcusnyberg.com/2009/11/23/install-printerdrivers-wmi/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 08:26:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[WMI]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=310</guid>
		<description><![CDATA[This is an example of how you install printerdrivers with .NET and WMI (Windows Management Instrumentation). Most examples on the Internet shows how this can be done with vbscript, printui.dll and such&#8230;
A list of properties can be found at MSDN Win32_PrinterDriver
Other topics:
How to install printerports with WMI and VB.NET
How to create a printerqueu with .NET [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example of how you install printerdrivers with .NET and WMI (Windows Management Instrumentation). Most examples on the Internet shows how this can be done with vbscript, printui.dll and such&#8230;</p>
<p>A list of properties can be found at <a href="http://msdn.microsoft.com/en-us/library/aa394366(VS.85).aspx">MSDN Win32_PrinterDriver</a></p>
<p>Other topics:<br />
<a href="http://www.marcusnyberg.com/2009/12/11/install-printerports-with-wmi-and-vb-net/">How to install printerports with WMI and VB.NET</a><br />
<a href="http://www.marcusnyberg.com/2010/01/12/how-to-create-a-printerqueu-with-net-and-wmi/">How to create a printerqueu with .NET and WMI</a></p>
<pre name="code" class="vb.net">
Imports System.Management

Dim infPath  as String = "c:\driver\printerdriver.inf"
Dim mp As ManagementPath = New ManagementPath("Win32_PrinterDriver")

Dim co As ConnectionOptions = New ConnectionOptions()
co.EnablePrivileges = True

Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

Dim mcPrinterDriver As New ManagementClass(ms, mp, Nothing)
mcPrinterDriver.SetPropertyValue("Name", "drivername")
mcPrinterDriver.SetPropertyValue("SupportedPlatform", "Windows NT x86") ' x86-architecture
'mcPrinterDriver.SetPropertyValue("SupportedPlatform", "Windows x64") ' x64-architecture
mcPrinterDriver.SetPropertyValue("Version", 3)
mcPrinterDriver.SetPropertyValue("FilePath", System.IO.Path.GetDirectoryName(infPath))
mcPrinterDriver.SetPropertyValue("InfName", infPath)

Dim inParams As System.Management.ManagementBaseObject = Nothing
inParams = mcPrinterDriver.GetMethodParameters("AddPrinterDriver")
inParams("DriverInfo") = CType(mcPrinterDriver, System.Management.ManagementBaseObject)
Dim outParams As System.Management.ManagementBaseObject = mcPrinterDriver.InvokeMethod("AddPrinterDriver", inParams, Nothing)

Dim uiReturnValue As UInteger = System.Convert.ToUInt32(outParams.Properties("ReturnValue").Value)
</pre>
<p>I have tested this in Windows XP, Windows 7 and Windows 2008R2. Make sure your account has privileges to install drivers.</p>
<p>On Windows XP the drivers are installed physically to:<br />
C:\WINNT\system32\spool\drivers</p>
<p>And in the registry:<br />
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/11/23/install-printerdrivers-wmi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
