<?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>Anthony Reinke &#187; script</title>
	<atom:link href="http://www.anthonyreinke.com/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anthonyreinke.com</link>
	<description>Rambling Thoughts of a Random Mind</description>
	<lastBuildDate>Wed, 01 Feb 2012 22:03:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing SNMP through the Command Line &#8211; Part 2</title>
		<link>http://www.anthonyreinke.com/2012/02/01/installing-snmp-through-the-command-line-part-2/</link>
		<comments>http://www.anthonyreinke.com/2012/02/01/installing-snmp-through-the-command-line-part-2/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 22:01:19 +0000</pubDate>
		<dc:creator>Anthony Reinke</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.anthonyreinke.com/?p=474</guid>
		<description><![CDATA[I added a batch script I wrote to install SNMP on a bunch of machine back on Jan. 14, 2012 (http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/). &#160;I have since modified the script. &#160;Changing the file from a .bat to a .cmd will allow you to right click and run as administrator on Windows 2008. &#160;Also I noticed in 2008, it [...]]]></description>
			<content:encoded><![CDATA[<p>I added a batch script I wrote to install SNMP on a bunch of machine back on Jan. 14, 2012 (<a href="http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/">http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/</a>). &nbsp;I have since modified the script. &nbsp;Changing the file from a .bat to a .cmd will allow you to right click and run as administrator on Windows 2008. &nbsp;Also I noticed in 2008, it defaults in to having the localhost as the only system that can communicate to the SNMP Service.</p>
<p>PsExec.exe @hosts.txt -s -c installsnmp.cmd</p>
<p>Below is the file to download. &nbsp;Rename the file to installsnmp.cmd<br />
<a href="http://www.anthonyreinke.com/wp-content/uploads/2012/02/installsnmp.cmd_.txt">installsnmp.cmd.txt</a></p>
<p>As always, please contact me if you have questions.</p>
<pre><span style="color: #00ff00;">@echo off</span></pre>
<pre><span style="color: #00ff00;">cls</span></pre>
<pre><span style="color: #00ff00;">REM Detect if the system is Windows Server 2003</span>
<span style="color: #00ff00;">systeminfo | find "2003" &gt; nul</span>
<span style="color: #00ff00;">if %ERRORLEVEL% == 0 goto 2003</span></pre>
<pre><span style="color: #00ff00;">REM Detect if the system is Windows XP</span>
<span style="color: #00ff00;">systeminfo | find "XP Pro" &gt; nul</span>
<span style="color: #00ff00;">if %ERRORLEVEL% == 0 goto XPPro</span></pre>
<pre><span style="color: #00ff00;">REM Detect if the system is Windows XP</span>
<span style="color: #00ff00;">systeminfo | find "2008" &gt; nul</span>
<span style="color: #00ff00;">if %ERRORLEVEL% == 0 goto 2008</span></pre>
<pre><span style="color: #00ff00;">REM If the system is Windows Vista, Windows Server 2008, or higher, </span>
<span style="color: #00ff00;">REM they have the required files built in.</span>
<span style="color: #00ff00;">goto ERROR</span></pre>
<pre><span style="color: #00ff00;">:2003</span>
<span style="color: #00ff00;">REM If Windows 2003, set the path to the i386 directory</span>
<span style="color: #00ff00;">REM Note: The path needs to be one level above the i386 directory</span>
<span style="color: #00ff00;">REM Example: if the path is \\server\share\windows2003\i386\ then</span>
<span style="color: #00ff00;">REM the path would be \\server\share\windows2003\</span>
<span style="color: #00ff00;">REM Note that the you need both a 32bit and 64bit versions</span></pre>
<pre><span style="color: #00ff00;">if (%PROCESSOR_ARCHITECTURE%) == (AMD64) (</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\Win2003x64\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\Win2003x64\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setW2003Path.reg</span></pre>
<pre><span style="color: #00ff00;">IF (%PROCESSOR_ARCHITECTURE%) == (x86) (</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\Win2003\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\Win2003\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setW2003Path.reg</span></pre>
<pre>
<span style="color: #00ff00;">REM Installing the created Registry File</span>
<span style="color: #00ff00;">regedit /s /q %temp%\setW2003Path.reg</span></pre>
<pre><span style="color: #00ff00;">goto SNMP</span></pre>
<pre><span style="color: #00ff00;">:XPPro</span>
<span style="color: #00ff00;">REM If Windows XP Professional, set the path to the i386 directory</span>
<span style="color: #00ff00;">REM Note: The path needs to be one level above the i386 directory</span>
<span style="color: #00ff00;">REM Example: if the path is \\server\share\windowsXP\i386\ then</span>
<span style="color: #00ff00;">REM the path would be \\server\share\windowsXP\</span>
<span style="color: #00ff00;">if (%PROCESSOR_ARCHITECTURE%) == (AMD64) (</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\XPProx64\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\XPProx64\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setXPProPath.reg</span>
<span style="color: #00ff00;">) ELSE IF (%PROCESSOR_ARCHITECTURE%) == (x86)</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\XPPro\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\XPPro\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setXPProPath.reg</span>
<span style="color: #00ff00;">)</span></pre>
<pre><span style="color: #00ff00;">REM Installing the created Registry File</span>
<span style="color: #00ff00;">regedit /s /q %temp%\setXPProPath.reg.reg</span></pre>
<pre><span style="color: #00ff00;">goto SNMP</span></pre>
<pre><span style="color: #00ff00;">:2008</span>
<span style="color: #00ff00;">REM Since 2008 stopped using the sysocmgr.exe to install features, in Vista and higher</span>
<span style="color: #00ff00;">REM you need to use the servermanagercmd.exe to add features. A great list of the </span>
<span style="color: #00ff00;">REM features and their command line install string is at:</span>
<span style="color: #00ff00;">REM http://www.techrepublic.com/blog/datacenter/install-windows-server-2008-features-with-servermanagercmd/294</span></pre>
<pre><span style="color: #00ff00;">servermanagercmd.exe -install SNMP-Services</span></pre>
<pre><span style="color: #00ff00;">goto Strings</span></pre>
<pre><span style="color: #00ff00;">:SNMP</span>
<span style="color: #00ff00;">REM Building the Unattended Install</span></pre>
<pre><span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo ;SetupMgrTag</span>
<span style="color: #00ff00;">echo [NetOptionalComponents]</span>
<span style="color: #00ff00;">echo SNMP=1</span>
<span style="color: #00ff00;">echo [SNMP]</span>
<span style="color: #00ff00;">echo Any_Host=YES</span>
<span style="color: #00ff00;">) &gt; %temp%\snmp.txt</span></pre>
<pre><span style="color: #00ff00;">REM Installing the SNMP application with the Unattended Install</span></pre>
<pre><span style="color: #00ff00;">sysocmgr /i:%windir%\inf\sysoc.inf /u:%temp%\snmp.txt</span></pre>
<pre><span style="color: #00ff00;">goto Strings</span></pre>
<pre><span style="color: #00ff00;">:Strings</span></pre>
<pre><span style="color: #00ff00;">REM Removing the public string</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [-HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\ValidCommunities]</span></pre>
<pre><span style="color: #00ff00;">REM Removing the only allow localhost communication, by default 2008 will only allow the </span>
<span style="color: #00ff00;">REM localhsot to talk to the SNMP service</span>
<span style="color: #00ff00;">echo [-HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\SNMP\Parameters\PermittedManagers]</span></pre>
<pre><span style="color: #00ff00;">REM Setting the SNMP strings</span>
<span style="color: #00ff00;">echo.</span></pre>
<pre><span style="color: #00ff00;">REM Setting the SNMP Contact Info</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\RFC1156Agent]</span>
<span style="color: #00ff00;">echo "sysContact"="Server Administrators"</span>
<span style="color: #00ff00;">echo "sysLocation"="Server Room"</span>
<span style="color: #00ff00;">echo "sysServices"=dword:0000004f</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">REM Setting the Read Only and Read Write Communities</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\ValidCommunities]</span>
<span style="color: #00ff00;">echo "readonly"=dword:00000004</span>
<span style="color: #00ff00;">echo "readwrite"=dword:00000008</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">REM Creating the Permitted Managers Key</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\SNMP\Parameters\PermittedManagers]</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">) &gt; %temp%\setupsnmp.reg</span></pre>
<pre><span style="color: #00ff00;">REM Installing the created Registry File</span></pre>
<pre><span style="color: #00ff00;">regedit /s /q %temp%\setupsnmp.reg</span></pre>
<pre><span style="color: #00ff00;">REM Cleaning Up</span></pre>
<pre><span style="color: #00ff00;">IF EXIST %temp%\setupsnmp.reg del %temp%\setupsnmp.reg</span>
<span style="color: #00ff00;">IF EXIST %temp%\setW2003Path.reg del %temp%\setW2003Path.reg</span>
<span style="color: #00ff00;">IF EXIST %temp%\setXPProPath.reg.reg del %temp%\setXPProPath.reg.reg</span>
<span style="color: #00ff00;">IF EXIST %temp%\snmp.txt del %temp%\snmp.txt</span></pre>
<pre><span style="color: #00ff00;">echo %COMPUTERNAME% Complete &gt;&gt; \\server\share\SNMP\SNMPInstall.txt</span></pre>
<pre><span style="color: #00ff00;">goto END</span></pre>
<pre><span style="color: #00ff00;">:ERROR</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo Could not determine the OS type</span>
<span style="color: #00ff00;">pause</span></pre>
<pre><span style="color: #00ff00;">goto END</span></pre>
<pre><span style="color: #00ff00;">:END</span></pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyreinke.com/2012/02/01/installing-snmp-through-the-command-line-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing SNMP through the Command Line</title>
		<link>http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/</link>
		<comments>http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 04:18:59 +0000</pubDate>
		<dc:creator>Anthony Reinke</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.anthonyreinke.com/?p=455</guid>
		<description><![CDATA[I needed a way to mass install SNMP to the servers in my environment.  The problem I was having was Microsoft Windows Server 2003 needing files from the CD.  We don&#8217;t copy the i386 directory from the CD for two reasons.  We store the files on the network and drive space is limit on a [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a way to mass install SNMP to the servers in my environment.  The problem I was having was Microsoft Windows Server 2003 needing files from the CD.  We don&#8217;t copy the i386 directory from the CD for two reasons.  We store the files on the network and drive space is limit on a lot of servers.  The batch script will check if the server is 2003.  If it is 2003, it will point the install cd to a network path or a local path.  Next it builds the  unattended install file.  Once the file is written, the system will add the SNMP feature per the unattended file.  After SNMP is installed, the registry keys are set for the SNMP community strings.  Lastly the script removes the temporary files it created.</p>
<p>Use this script in combination to PSTools&#8217; PSExec and you can mass install.  Create a list of systems you want to install this on and call it hosts.txt.  Each server needs to be on it&#8217;s own line and it is best to use the fully qualified name or IP Address.  Copy the hosts.txt and installsnmp.bat file in to your PSTools directory and run the following command:</p>
<pre><span style="color: #00ff00;">PsExec.exe @hosts.txt -s -c installsnmp.bat</span></pre>
<p><a href="http://www.anthonyreinke.com/wp-content/uploads/2012/01/installsnmp.txt">Download the Install SNMP Batch File, just rename to a .bat file.</a></p>
<p>&nbsp;</p>
<pre></pre>
<pre><span style="color: #00ff00;">@echo off</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">echo %COMPUTERNAME% Started &gt;&gt; \\server\share\SNMP\SNMPInstall.txt</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Detect if the system is Windows Server 2003</span>
<span style="color: #00ff00;">systeminfo | find "2003" &gt; nul</span>
<span style="color: #00ff00;">if %ERRORLEVEL% == 0 goto 2003</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Detect if the system is Windows XP</span>
<span style="color: #00ff00;">systeminfo | find "XP Pro" &gt; nul</span>
<span style="color: #00ff00;">if %ERRORLEVEL% == 0 goto XPPro</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM If the system is Windows Vista, Windows Server 2008, or higher, </span>
<span style="color: #00ff00;">REM they have the required files built in.</span>
<span style="color: #00ff00;">goto SNMP</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">:2003</span>
<span style="color: #00ff00;">REM If Windows 2003, set the path to the i386 directory</span>
<span style="color: #00ff00;">REM Note: The path needs to be one level above the i386 directory</span>
<span style="color: #00ff00;">REM Example: if the path is \\server\share\windows2003\i386\ then</span>
<span style="color: #00ff00;">REM the path would be \\server\share\windows2003\</span>
<span style="color: #00ff00;">REM Note that the you need both a 32bit and 64bit versions</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">if (%PROCESSOR_ARCHITECTURE%) == (AMD64) (</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\Win2003x64\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\Win2003x64\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setW2003Path.reg</span>
<span style="color: #00ff00;">) ELSE IF (%PROCESSOR_ARCHITECTURE%) == (x86)</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\Win2003\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\Win2003\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setW2003Path.reg</span>
<span style="color: #00ff00;">)</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Installing the created Registry File</span>
<span style="color: #00ff00;">regedit /s /q %temp%\setW2003Path.reg</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">goto SNMP</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">:XPPro</span>
<span style="color: #00ff00;">REM If Windows XP Professional, set the path to the i386 directory</span>
<span style="color: #00ff00;">REM Note: The path needs to be one level above the i386 directory</span>
<span style="color: #00ff00;">REM Example: if the path is \\server\share\windowsXP\i386\ then</span>
<span style="color: #00ff00;">REM the path would be \\server\share\windowsXP\</span>
<span style="color: #00ff00;">if (%PROCESSOR_ARCHITECTURE%) == (AMD64) (</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\XPProx64\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\XPProx64\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setXPProPath.reg</span>
<span style="color: #00ff00;">) ELSE IF (%PROCESSOR_ARCHITECTURE%) == (x86)</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]</span>
<span style="color: #00ff00;">echo "SourcePath"="\\\\server\\share\\Extracted\\XPPro\\"</span>
<span style="color: #00ff00;">echo "ServicePackSourcePath"="\\\\server\\share\\Extracted\\XPPro\\"</span>
<span style="color: #00ff00;">) &gt; %temp%\setXPProPath.reg</span>
<span style="color: #00ff00;">)</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Installing the created Registry File</span>
<span style="color: #00ff00;">regedit /s /q %temp%\setXPProPath.reg.reg</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">goto SNMP</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">:SNMP</span>
<span style="color: #00ff00;">REM Building the Unattended Install</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo ;SetupMgrTag</span>
<span style="color: #00ff00;">echo [NetOptionalComponents]</span>
<span style="color: #00ff00;">echo SNMP=1</span>
<span style="color: #00ff00;">echo [SNMP]</span>
<span style="color: #00ff00;">echo Any_Host=YES</span>
<span style="color: #00ff00;">) &gt; %temp%\snmp.txt</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Installing the SNMP application with the Unattended Install</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">sysocmgr /i:%windir%\inf\sysoc.inf /u:%temp%\snmp.txt</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">goto Strings</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">:2008</span>
<span style="color: #00ff00;">REM Since 2008 stopped using the sysocmgr.exe to install features, in Vista and higher</span>
<span style="color: #00ff00;">REM you need to use the servermanagercmd.exe to add features. A great list of the </span>
<span style="color: #00ff00;">REM features and their command line install string is at:</span>
<span style="color: #00ff00;">REM http://www.techrepublic.com/blog/datacenter/install-windows-server-2008-features-with-servermanagercmd/294</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">servermanagercmd.exe -install SNMP-Services</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">goto Strings</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">:Strings</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Removing the public string</span>
<span style="color: #00ff00;">(</span>
<span style="color: #00ff00;">echo Windows Registry Editor Version 5.00</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [-HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\ValidCommunities]</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Setting the SNMP strings</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\RFC1156Agent]</span>
<span style="color: #00ff00;">echo "sysContact"="Server Administrators"</span>
<span style="color: #00ff00;">echo "sysLocation"="Server Room"</span>
<span style="color: #00ff00;">echo "sysServices"=dword:0000004f</span>
<span style="color: #00ff00;">echo.</span>
<span style="color: #00ff00;">echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SNMP\Parameters\ValidCommunities]</span>
<span style="color: #00ff00;">echo "readonly"=dword:00000004</span>
<span style="color: #00ff00;">echo "readwrite"=dword:00000008</span>
<span style="color: #00ff00;">) &gt; %temp%\setupsnmp.reg</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Installing the created Registry File</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">regedit /s /q %temp%\setupsnmp.reg</span></pre>
<pre></pre>
<pre><span style="color: #00ff00;">REM Cleaning Up</span></pre>
<pre></pre>
<p><span style="color: #00ff00;">IF EXIST %temp%\setupsnmp.reg del %temp%\setupsnmp.reg</span><br />
<span style="color: #00ff00;">IF EXIST %temp%\setW2003Path.reg del %temp%\setW2003Path.reg</span><br />
<span style="color: #00ff00;">IF EXIST %temp%\setXPProPath.reg.reg del %temp%\setXPProPath.reg.reg</span><br />
<span style="color: #00ff00;">IF EXIST %temp%\snmp.txt del %temp%\snmp.txt</span></p>
<p>&nbsp;</p>
<p><span style="color: #00ff00;">echo %COMPUTERNAME% Complete &gt;&gt; \\server\share\SNMP\SNMPInstall.txt</span></p>
<p><span style="color: #00ff00;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyreinke.com/2012/01/14/installing-snmp-through-the-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Information Gathering on My Own Servers</title>
		<link>http://www.anthonyreinke.com/2011/01/17/information-gathering-on-my-own-servers/</link>
		<comments>http://www.anthonyreinke.com/2011/01/17/information-gathering-on-my-own-servers/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 20:33:59 +0000</pubDate>
		<dc:creator>Anthony Reinke</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[bit]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[level]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[pack]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[version]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[warranty]]></category>
		<category><![CDATA[write]]></category>

		<guid isPermaLink="false">http://www.anthonyreinke.com/?p=384</guid>
		<description><![CDATA[Currently I am having an issue with not knowing information about the servers I am responsible.   I am not happy not knowing things.  I spent a little time gather different parts of different scripts (hacker / script kiddie style) and compiling them in to one Visual Basic Script.  This script is designed to work [...]]]></description>
			<content:encoded><![CDATA[<p>Currently I am having an issue with not knowing information about the servers I am responsible.   I am not happy not knowing things.  I spent a little time gather different parts of different scripts (hacker / script kiddie style) and compiling them in to one Visual Basic Script.  This script is designed to work against Dell Servers.  It will ask the computer for it name, the OS, OS version number, Service Packs, Bit Level (32 or 64 bit), Dell Warranty info, list of local users, and a list of local groups and the users in the groups.  It takes the list of servers from &#8220;hosts.txt&#8221; which is just a list of servers or ip addresses where there is one per line.  It will write all the information it gathers in to a file called &#8220;report.txt&#8221;.</p>
<p>Download the <a href="http://www.anthonyreinke.com/repository/SystemInfo.vbs">.VBS File</a></p>
<p>Here is the code:</p>
<blockquote>
<div id="_mcePaste">Option Explicit</div>
<div id="_mcePaste">Dim url, svctag, wshShell, wshNetwork</div>
<div id="_mcePaste">Dim strComputer, colGroups, objGroup, objUser</div>
<div id="_mcePaste">Dim objWMIService, colItems, objItem</div>
<div id="_mcePaste">Dim warrantyRows, warrantyCols</div>
<div id="_mcePaste">Dim objsvc,svccount, errorChecking,svc,objNetwork,colAccounts</div>
<div id="_mcePaste">Dim get_OS_Bit, info, strComputer2, oReg, strKeyPath, strValueName, strValue</div>
<div id="_mcePaste">Dim objShell, objIE, objWMI</div>
<div id="_mcePaste">Dim colOSes, objOS</div>
<div id="_mcePaste">Dim objFSO, objTextFile, objTextFileW, objTextFileO, strNextLine, arrServiceList</div>
<div id="_mcePaste">Dim i, result</div>
<div id="_mcePaste">Const ForReading = 1</div>
<div id="_mcePaste">Const ForAppending = 8</div>
<div id="_mcePaste">Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)</div>
<div id="_mcePaste">Set objTextFileW = objFSO.OpenTextFile (&#8220;report.txt&#8221;, ForAppending, True)</div>
<div id="_mcePaste">Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)</div>
<div id="_mcePaste">Set objTextFileO = objFSO.OpenTextFile _</div>
<div id="_mcePaste">(&#8220;hosts.txt&#8221;, ForReading)</div>
<div id="_mcePaste">Do Until objTextFileO.AtEndOfStream</div>
<div id="_mcePaste">strNextLine = objTextFileO.Readline</div>
<div id="_mcePaste">arrServiceList = Split(strNextLine , &#8220;,&#8221;)</div>
<div id="_mcePaste">strComputer = arrServiceList(0)</div>
<div id="_mcePaste">wscript.echo strComputer</div>
<div id="_mcePaste">On Error Resume Next</div>
<div id="_mcePaste">Set colOSes = objWMIService.ExecQuery(&#8220;Select * from Win32_OperatingSystem&#8221;)</div>
<div id="_mcePaste">For Each objOS in colOSes</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;########################################&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;==            Computer Info           ==&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Computer Name      : &#8221; &amp; objOS.CSName</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">Set objWMI = GetObject(&#8220;winmgmts:\&#8221; &amp; strComputer &amp; &#8220;rootCIMV2&#8243;)</div>
<div id="_mcePaste">Set colItems = objWMI.ExecQuery(&#8220;SELECT * FROM Win32_OperatingSystem&#8221;,,48)</div>
<div id="_mcePaste">For Each objItem in colItems</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Operating System   : &#8221; &amp; objItem.Caption</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;OS Version Number  : &#8221; &amp; objItem.Version</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Service Pack       : &#8221; &amp; objItem.ServicePackMajorVersion</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">const HKEY_LOCAL_MACHINE = &amp;H80000002</div>
<div id="_mcePaste">Set oReg=GetObject(&#8220;winmgmts:{impersonationLevel=impersonate}!\&#8221; &amp; strComputer &amp; &#8220;rootdefault:StdRegProv&#8221;)</div>
<div id="_mcePaste">strKeyPath = &#8220;HARDWAREDESCRIPTIONSystemCentralProcessor &#8221;</div>
<div id="_mcePaste">strValueName = &#8220;Identifier&#8221;</div>
<div id="_mcePaste">oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue</div>
<div id="_mcePaste">if (instr(strValue,&#8221;x86&#8243;)) then</div>
<div id="_mcePaste">get_OS_Bit=&#8221;32&#8243;</div>
<div id="_mcePaste">elseif (instr(strValue,&#8221;64&#8243;)) then</div>
<div id="_mcePaste">get_OS_Bit=&#8221;64&#8243;</div>
<div id="_mcePaste">else</div>
<div id="_mcePaste">get_OS_Bit=&#8221;NotSure&#8221;</div>
<div id="_mcePaste">end if</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;OS is              : &#8221; &amp; get_OS_Bit &amp; &#8220;bit&#8221;</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;==  Get the Dell warranty information ==&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">url = &#8220;http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&amp;cs=RC956904&amp;l=en&amp;s=hied&amp;~lt=bodyonly&amp;~wsf=tabs&amp;servicetag=&#8221;</div>
<div id="_mcePaste">set objIE=createobject(&#8220;internetexplorer.application&#8221;)</div>
<div id="_mcePaste">set objShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)</div>
<div id="_mcePaste">set objWMI = GetObject(&#8220;winmgmts:{impersonationLevel=impersonate}!\&#8221; &amp; strComputer &amp; &#8220;rootcimv2&#8243;)</div>
<div id="_mcePaste">If InStr(UCase(objWMI.ExecQuery(&#8220;Select Manufacturer From Win32_ComputerSystem&#8221;).ItemIndex(0).Manufacturer), &#8220;DELL&#8221;) = 0 then Err.Raise 2, &#8220;This is not a Dell dude!&#8221;, &#8220;No Service Tag&#8221;</div>
<div id="_mcePaste">svctag = objWMI.ExecQuery  (&#8220;Select SerialNumber from Win32_BIOS&#8221;).ItemIndex(0).SerialNumber</div>
<div id="_mcePaste">Set objWMIService = GetObject(&#8220;winmgmts:&#8221; _</div>
<div id="_mcePaste">&amp; &#8220;{impersonationLevel=impersonate}!\&#8221; _</div>
<div id="_mcePaste">&amp; strComputer &amp; &#8220;rootcimv2&#8243;)</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Service Tag        : &#8221; &amp; svctag</div>
<div id="_mcePaste">objIE.navigate url &amp; svctag</div>
<div id="_mcePaste">do while objIE.readystate&lt;&gt;4 : wscript.sleep 50 : loop</div>
<div id="_mcePaste">set warrantyRows = objIE.document.getElementsByTagName(&#8220;table&#8221;).item(1).getElementsByTagName(&#8220;table&#8221;).item(2).getElementsByTagName(&#8220;table&#8221;).item(0).getElementsByTagName(&#8220;tr&#8221;)</div>
<div id="_mcePaste">For i = 1 to warrantyRows.length &#8211; 1</div>
<div id="_mcePaste">set warrantyCols = warrantyRows.item(i).getElementsByTagName(&#8220;td&#8221;)</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Description        : &#8221; &amp; warrantyCols.item(0).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Provider           : &#8221; &amp; warrantyCols.item(1).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Warranty Extension : &#8221; &amp; warrantyCols.item(2).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Start Date         : &#8221; &amp; warrantyCols.item(3).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;End Date           : &#8221; &amp; warrantyCols.item(4).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Days Left          : &#8221; &amp; warrantyCols.item(5).innerText</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;==       List all local users         ==&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;========================================&#8221;</div>
<div id="_mcePaste">Set objNetwork = CreateObject(&#8220;Wscript.Network&#8221;)</div>
<div id="_mcePaste">&#8216;strComputer = objNetwork.ComputerName</div>
<div id="_mcePaste">Set colAccounts = GetObject(&#8220;WinNT://&#8221; &amp; strComputer &amp; &#8220;&#8221;)</div>
<div id="_mcePaste">colAccounts.Filter = Array(&#8220;user&#8221;)</div>
<div id="_mcePaste">For Each objUser In colAccounts</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Local User         : &#8221; &amp; objUser.Name</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;===========================================&#8221;</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;== List all local groups and their users ==&#8221;</div>
<div id="_mcePaste">objTextFileW.Writeline &#8220;===========================================&#8221;</div>
<div id="_mcePaste">Set colGroups = GetObject(&#8220;WinNT://&#8221; &amp; strComputer &amp; &#8220;&#8221;)</div>
<div id="_mcePaste">colGroups.Filter = Array(&#8220;group&#8221;)</div>
<div id="_mcePaste">For Each objGroup In colGroups</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Group              : &#8221; &amp; objGroup.Name</div>
<div id="_mcePaste">For Each objUser in objGroup.Members</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;User               : &#8221; &amp; objUser.Name</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">Next</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;== List all services ==&#8221;</div>
<div id="_mcePaste">set objsvc = GetObject(&#8220;winmgmts:{impersonationLevel=impersonate}\&#8221; &amp; strComputer &amp; &#8220;rootcimv2&#8243;).ExecQuery (&#8220;SELECT * FROM Win32_Service&#8221;)</div>
<div id="_mcePaste">for each svc in objsvc</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Service            : &#8221; &amp; svc.displayname</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Current Status     : &#8221; &amp; svc.state</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Startus Type       : &#8221; &amp; svc.startmode</div>
<div id="_mcePaste">objTextFileW.WriteLine &#8220;Run Server As      : &#8221; &amp; svc.startname</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">next</div>
<div id="_mcePaste">objTextFileW.WriteLine</div>
<div id="_mcePaste">Loop</div>
<div id="_mcePaste">objTextFileW.Close</div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyreinke.com/2011/01/17/information-gathering-on-my-own-servers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Life as a G33k</title>
		<link>http://www.anthonyreinke.com/2009/06/20/life-as-a-g33k/</link>
		<comments>http://www.anthonyreinke.com/2009/06/20/life-as-a-g33k/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 04:56:41 +0000</pubDate>
		<dc:creator>Anthony Reinke</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[drink]]></category>
		<category><![CDATA[energy]]></category>
		<category><![CDATA[energy drink]]></category>
		<category><![CDATA[esxi]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[g33k]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[im]]></category>
		<category><![CDATA[khaos]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[monster]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tickets]]></category>
		<category><![CDATA[utorrent]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.anthonyreinke.com/?p=5</guid>
		<description><![CDATA[I am sitting here on my main desktop writing this.  On one tab of FireFox I have my Facebook open.  On the next tab I have this page open.  I have my uTorrent runningin the background.  My laptop sits next to me with a VPN connection in to work.  I am running scripts and adding [...]]]></description>
			<content:encoded><![CDATA[<p>I am sitting here on my main desktop writing this.  On one tab of FireFox I have my Facebook open.  On the next tab I have this page open.  I have my uTorrent runningin the background.  My laptop sits next to me with a VPN connection in to work.  I am running scripts and adding accounts in to group and verifying that the servers got the correct grouping.  My IDS is humming along.  My ESXi server is pumping out the heat as the server tries to keep the 8 processors cool.  I have 4 IM windows up on the laptop and 3 chat windows in facebook.  I have 7 command prompt windows pinging servers asking them if they are still up.</p>
<p>It is now 1:35am and I have been up since 5:30am the day before.  No worries, I got my energy drink (Monster Khaos).  Odds are I will be in to work between 9 and 10am.  Why?  Because I have 40 tickets to complete and more to be assigned.</p>
<p>Such is the life of a geek.<br />
B-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyreinke.com/2009/06/20/life-as-a-g33k/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

