<?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>Simpleman &#38; Simple Life &#187; Shells &amp; Scripts</title>
	<atom:link href="http://xuming.info/category/shells-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://xuming.info</link>
	<description>Learn to write and appreciate</description>
	<lastBuildDate>Sat, 11 Dec 2010 03:05:06 +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>利用 wmi 获取计算机信息时出现“runtime error permission denied getobject”的解决</title>
		<link>http://xuming.info/2007/09/1035/</link>
		<comments>http://xuming.info/2007/09/1035/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 02:49:52 +0000</pubDate>
		<dc:creator>xuming</dc:creator>
				<category><![CDATA[Shells & Scripts]]></category>
		<category><![CDATA[DCOM]]></category>
		<category><![CDATA[denied]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[runtime]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://xuming.info/?p=1035</guid>
		<description><![CDATA[在使用利用 WMI 功能获取计算机系统信息的脚本的时候，往往会出现“runtime error permission denied getobject”这样的错误，下面分 Win2000 和 Win2003 平台分别说明解决的方法。 Win2000 运行 dcomcnfg 命令 重启 COM+ Event System 和 Windows Managemetn Instrumentation 服务。 Win2003 运行 dcomcnfg 命令 如图，选中 My Computer 的 Properities， Check “Enable Distributed COM on this computer”。 重启 COM+ Event System 和 Windows Managemetn Instrumentation 服务。 ################################## 个人声明：此中文章皆为原创，如有转载但请注明出处，谢谢！！ 批评与建议请联系：simpleman.xu#gmail.com #################################]]></description>
			<content:encoded><![CDATA[<p>在使用利用 WMI 功能获取计算机系统信息的脚本的时候，往往会出现“runtime error permission denied getobject”这样的错误，下面分 Win2000 和 Win2003 平台分别说明解决的方法。</p>
<p><b>Win2000</b></p>
<p>运行 dcomcnfg 命令</p>
<p><img src="http://lh3.google.com/simpleman.xu/RudTZ1VIxXI/AAAAAAAAAP8/zh3L4MFtDYE/image001.gif.jpg?imgmax=512"></p>
<p>重启 COM+ Event System 和 Windows Managemetn Instrumentation 服务。</p>
<p><b>Win2003</b></p>
<p>运行 dcomcnfg 命令</p>
<p><img src="http://lh4.google.com/simpleman.xu/RudTaFVIxYI/AAAAAAAAAQE/JhgKv1_QlTs/image002.gif.jpg?imgmax=512"></p>
<p>如图，选中 My Computer 的 Properities，</p>
<p><img src="http://lh6.google.com/simpleman.xu/RudTalVIxZI/AAAAAAAAAQM/kLGm6wuFfYY/image004.jpg?imgmax=512"></p>
<p>Check “Enable Distributed COM on this computer”。</p>
<p>重启 COM+ Event System 和 Windows Managemetn Instrumentation 服务。</p>
<p>##################################</p>
<p><b>个人声明：此中文章皆为原创，如有转载但请注明出处，谢谢！！<br />
批评与建议请联系：simpleman.xu#gmail.com </b></p>
<p>#################################</p>
]]></content:encoded>
			<wfw:commentRss>http://xuming.info/2007/09/1035/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VBS Script To Verify If A Specified Hot Fix Is Installed On A List Of Remote Machines</title>
		<link>http://xuming.info/2007/08/1013/</link>
		<comments>http://xuming.info/2007/08/1013/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 08:21:11 +0000</pubDate>
		<dc:creator>xuming</dc:creator>
				<category><![CDATA[Shells & Scripts]]></category>
		<category><![CDATA[HotFix]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://xuming.info/?p=1013</guid>
		<description><![CDATA[This article was Previously posted on Don Hite&#8217;s Blog This VBS script will take a Hot Fix ID from an input dialog box and will determine whether or not the Hot Fix is installed on a list of machines contained in a text file called MachineList.Txt. It will then write the results to an Excel [...]]]></description>
			<content:encoded><![CDATA[<p>This article was Previously posted on <a href="http://myitforum.com/cs2/blogs/dhite">Don Hite&#8217;s Blog</a></p>
<p>This VBS script will take a Hot Fix ID from an input dialog box and will determine whether or not the Hot Fix is installed on a list of machines contained in a text file called MachineList.Txt. It will then write the results to an Excel spreadsheet.</p>
<p class="hint"><b>Attention!!!</b></p>
<p>Note: To hard code the Hot Fix ID you can remove the line that reads: strHotFixId = InputBox (&#8220;Enter Hot Fix ID&#8221;) and replace it with: strHotFixId = &#8220;KB931836&#8243;
</p>
<p>VBS Script:</p>
<pre class="source">
strHotFixId = InputBox ("Enter Hot Fix ID")

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2

objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = strHotFixId &#038; " Install Date"

Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine

Set objWMIService = GetObject("winmgmts:\\" &#038; strComputer &#038; "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering Where HotFixID ='" &#038; strHotFixId &#038; "'")

If colItems.Count > 0 Then
For Each objItem In colItems
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
objExcel.Cells(intRow, 2).Value = objItem.InstalledOn
Next
Else
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
objExcel.Cells(intRow, 2).Value = "Not Installed"
If objExcel.Cells(intRow, 2).Value = "Not Installed" Then
objExcel.Cells(intRow, 1).Font.ColorIndex = 3
objExcel.Cells(intRow, 2).Font.ColorIndex = 3
Else
End If
End If

intRow = intRow + 1
Loop

objExcel.Range("A1:B1").Select
objExcel.Cells.HorizontalAlignment = 2
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit

MsgBox "Done"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://xuming.info/2007/08/1013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nbmail.cmd troubleshooting</title>
		<link>http://xuming.info/2007/05/1005/</link>
		<comments>http://xuming.info/2007/05/1005/#comments</comments>
		<pubDate>Mon, 28 May 2007 08:57:26 +0000</pubDate>
		<dc:creator>xuming</dc:creator>
				<category><![CDATA[Shells & Scripts]]></category>
		<category><![CDATA[Blat]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[NetBackup]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://xuming.info/?p=1005</guid>
		<description><![CDATA[Top ten reasons why nbmail can fail: BLAT is commented out in the nbmail.cmd script &#8212; remove the &#8216;@rem&#8217; from in front of the BLAT command. No email address configured or email address incorrectly configured on Universal Settings tab. The BLAT line in nbmail.cmd is not correctly configured; syntax has changed in the later versions [...]]]></description>
			<content:encoded><![CDATA[<h4>Top ten reasons why nbmail can fail:</h4>
<ol>
<li>BLAT is commented out in the nbmail.cmd script &#8212; remove the &#8216;@rem&#8217; from in front of the BLAT command.
<li>No email address configured or email address incorrectly configured on Universal Settings tab.
<li>The BLAT line in nbmail.cmd is not correctly configured; syntax has changed in the later versions &#8212; check the readme for your version of BLAT.
<li>BLAT is not on the path, and no path was specified in nbmail.cmd &#8212; place the blat.exe program in a directory on your path, or add the path before BLAT in the script.
<li>BLAT version is greater than 1.84, and no profile was created &#8212; see the BLAT readme for details on profiles.
<li>Mail account did not exist on email server &#8212; create the account.
<li>Mail server required authentication for Simple Mail Transfer Protocol (SMTP), and the account used for VERITAS NetBackup &#8482; client process is not authorized &#8212; change user account for NetBackup Client Service (default is local system, which may not have permission to send mail).
<li> BLAT sometimes needs the -ti &lt;n&gt; timeout parameter if there are delays in the system &#8212; &lt;n&gt; is in seconds.
<li>Command line extensions are not enabled &#8212; The registry key HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions should be set to 0&#215;1.
<li>BLAT binary is corrupt or incompatible with email system &#8212; download a newer version.
</ol>
<h3>如何查看 NetBackup 程序调用了 nbmail.cmd 呢？</h3>
<p>答案是通过setting up the BPCD log。具体步骤如下：</p>
<ol>
<li>Select Client sends mail on Universal Settings tab (properties on the master server). The option Server sends mail does not log anything in the BPCD log, so even if you require this option, test it with the Client setting first.
<li>Make sure that an email address is configured on the Universal Settings tab.
<li>Make sure the call to BLAT is uncommented in the nbmail.cmd script.
<li>Make sure that a directory called BPCD exists in NetBackup\Logs on the master server.
<li>a. For NetBackup 3.4 only: Launch the NetBackup client, click Actions | Configure and go to the Troubleshooting tab.  Enter 2 for General and 9 for Verbose. <br />
	b. For NetBackup 4.5 only &#8211; Launch the Backup, Archive and Restore program, click File | NetBackup Client Properties and go to the Troubleshooting tab. Enter 2 for General and 5 for Verbose.</p>
<li>Re-start the NetBackup Client Service to make sure these settings take effect.
<li>Run a backup of a directory on the master server.
<li>The BPCD log should contain something similar to the following: <br />
07:34:04.128 [3864.4052] &lt;2&gt; bpcd main: BPCD_SEND_MAIL_RQST <br />
07:34:04.128 [3864.4052] &lt;2&gt; bpcd main: mailaddr = joe.bloggs@veritas.com <br />
07:34:04.128 [3864.4052] &lt;2&gt; bpcd main: subject = Backup on MYMASTER &#8211; 0 started <br />
07:34:04.128 [3864.4052] &lt;2&gt; bpcd main: message = Backup on client MYMASTER by root succeeded. </p>
<p>File list<br />
&#8212;&#8212;&#8212;<br />
C:\WINNT\system32\drivers\etc</p>
<p>07:34:04.128 [3864.4052] &lt;2&gt; sendViaScript: attempting to send mail<br />
07:34:04.198 [3864.4052] &lt;2&gt; bpcd main: BPCD_DISCONNECT_RQST
</ol>
<p>If you don&#8217;t see this in the log, then nbmail is not being called, and you have a configuration problem within NetBackup itself. If you see the entries in the log, but receive no email, then verify whether the email address is correct and valid. If the email address is correct, then the problem lies either with the nbmail.cmd script itself, or with BLAT.</p>
<h3>Troubleshooting BLAT:</h3>
<p>The later versions of BLAT (from version 1.82 onwards) use profiles. The idea is that you configure your user or server and any other settings for the mail system in a profile and then just specify this when you use the command. The following technote describes this: <a href="http://support.veritas.com/docs/244258"> http://support.veritas.com/docs/244258 </a></p>
<p>So an appropriate change in nbmail.cmd would be to change the BLAT line as follows: </p>
<pre class="input">
@blat %3 -s %2 -t %1 -p NetBackup -q
</pre>
<p>where NetBackup is a profile you created. </p>
<p>When testing BLAT, you need to remove the -q switch and pipe the output to a file; you could replace the above line with: </p>
<pre class="input">
@echo:Testing %1 ,%2 ,%3 >>C:\Testing.txt
&lt;blat&gt; %3 -s %2 -t %1 -p NetBackup>>c:\Testing.txt
</pre>
<p>*** Note the emission of -q switch *** </p>
<p>When you test nbmail.cmd from the command line, it is helpful to use the same account that NetBackup client service is using, this will help highlight any account permission issues that may stop the process from working. </p>
]]></content:encoded>
			<wfw:commentRss>http://xuming.info/2007/05/1005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>blat 基本用法</title>
		<link>http://xuming.info/2007/05/1003/</link>
		<comments>http://xuming.info/2007/05/1003/#comments</comments>
		<pubDate>Mon, 28 May 2007 08:14:08 +0000</pubDate>
		<dc:creator>xuming</dc:creator>
				<category><![CDATA[NetBackup]]></category>
		<category><![CDATA[Shells & Scripts]]></category>
		<category><![CDATA[Blat]]></category>

		<guid isPermaLink="false">http://xuming.info/?p=1003</guid>
		<description><![CDATA[blat -to xnming21@163.com -cc xnming21@hotmail.com -subject test -body "This is a test." -attach 20070523.txt 具体语法如下 Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29) Win32 console utility to send mail via SMTP or post to usenet via NNTP by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde http://www.blat.net syntax: Blat &#60;filename&#62; -to &#60;recipient&#62; [optional switches (see below)] Blat -install &#60;server addr&#62; [...]]]></description>
			<content:encoded><![CDATA[<pre class="input">
blat -to xnming21@163.com -cc xnming21@hotmail.com -subject test -body "This is a test." -attach 20070523.txt
</pre>
<h4>具体语法如下</h4>
<pre class="output">
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)

Win32 console utility to send mail via SMTP or post to usenet via NNTP
by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde

http://www.blat.net

syntax:
  Blat &lt;filename&gt; -to &lt;recipient&gt; [optional switches (see below)]
  Blat -install &lt;server addr&gt; &lt;sender's addr&gt; [&lt;try&gt;[&lt;port&gt;[&lt;profile&gt;]]] [-q]
  Blat -profile [-delete | "&lt;default&gt;"] [profile1] [profileN] [-q]
  Blat -h

-------------------------------- Installation ---------------------------------
-install[SMTP|NNTP|POP3] &lt;server addr&gt; &lt;sender's email addr&gt; [&lt;try n times&gt;
                [&lt;port&gt; [&lt;profile&gt; [&lt;username&gt; [&lt;password&gt;]]]]]
                : set server, sender, number of tries and port for profile
                  (&lt;try n times&gt; and &lt;port&gt; may be replaced by '-')
                  port defaults are SMTP=25, NNTP=119, POP3=110
                  default profile can be specified with a '-'
                  username and/or password may be stored to the registry
                  order of options is specific
                  use -installNNTP for storing NNTP information
                  use -installPOP3 for storing POP3 information
                      (sender and try are ignored, use '-' in place of these)

--------------------------------- The Basics ----------------------------------
&lt;filename&gt;      : file with the message body to be sent
                  if your message body is on the command line, use a hyphen (-)
                  as your first argument, and -body followed by your message
                  if your message will come from the console/keyboard, use the
                  hyphen as your first argument, but do not use -body option.
-of &lt;file&gt;      : text file containing more options (also -optionfile)
-to &lt;recipient&gt; : recipient list (also -t) (comma separated)
-tf &lt;file&gt;      : recipient list filename
-cc &lt;recipient&gt; : carbon copy recipient list (also -c) (comma separated)
-cf &lt;file&gt;      : cc recipient list filename
-bcc &lt;recipient&gt;: blind carbon copy recipient list (also -b)
                  (comma separated)
-bf &lt;file&gt;      : bcc recipient list filename
-maxNames &lt;x&gt;   : send to groups of &lt;x&gt; number of recipients
-ur             : set To: header to Undisclosed Recipients if not using the
                  -to and -cc options
-subject &lt;subj&gt; : subject line, surround with quotes to include spaces(also -s)
-ss             : suppress subject line if not defined
-sf &lt;file&gt;      : file containing subject line
-body &lt;text&gt;    : message body, surround with quotes to include spaces
-sig &lt;file&gt;     : text file containing your email signature
-tag &lt;file&gt;     : text file containing taglines, to be randomly chosen
-ps &lt;file&gt;      : final message text, possibly for unsubscribe instructions

----------------------------- Registry overrides ------------------------------
-p &lt;profile&gt;    : send with server, user, and port defined in &lt;profile&gt;
                : use username and password if defined in &lt;profile&gt;
-profile        : list all profiles in the Registry
-server &lt;addr&gt;  : specify SMTP server to be used (optionally, addr:port)
-serverSMTP &lt;addr&gt;
                : same as -server
-serverNNTP &lt;addr&gt;
                : specify NNTP server to be used (optionally, addr:port)
-serverPOP3 &lt;addr&gt;
                : specify POP3 server to be used (optionally, addr:port)
                  when POP3 access is required before sending email
-f &lt;sender&gt;     : override the default sender address (must be known to server)
-i &lt;addr&gt;       : a 'From:' address, not necessarily known to the server
-port &lt;port&gt;    : port to be used on the SMTP server, defaults to SMTP (25)
-portSMTP &lt;port&gt;: same as -port
-portNNTP &lt;port&gt;: port to be used on the NNTP server, defaults to NNTP (119)
-portPOP3 &lt;port&gt;: port to be used on the POP3 server, defaults to POP3 (110)
-u &lt;username&gt;   : username for AUTH LOGIN (use with -pw)
-pw &lt;password&gt;  : password for AUTH LOGIN (use with -u)
-pu &lt;username&gt;  : username for POP3 LOGIN (use with -ppw)
-ppw &lt;password&gt; : password for POP3 LOGIN (use with -pu)

---------------------- Miscellaneous RFC header switches ----------------------
-organization &lt;organization&gt;
                : Organization field (also -o and -org)
-ua             : include User-Agent header line instead of X-Mailer
-x &lt;X-Header: detail&gt;
                : custom 'X-' header.  eg: -x "X-INFO: Blat is Great!"
-noh            : prevent X-Mailer/User-Agent header from showing Blat homepage
-noh2           : prevent X-Mailer header entirely
-d              : request disposition notification
-r              : request return receipt
-charset &lt;cs&gt;   : user defined charset.  The default is ISO-8859-1
-a1 &lt;header&gt;    : add custom header line at the end of the regular headers
-a2 &lt;header&gt;    : same as -a1, for a second custom header line
-dsn &lt;nsfd&gt;     : use Delivery Status Notifications (RFC 3461)
                  n = never, s = successful, f = failure, d = delayed
                  can be used together, however N takes precedence
-hdrencb        : use base64 for encoding headers, if necessary
-hdrencq        : use quoted-printable for encoding headers, if necessary
-priority &lt;pr&gt;  : set message priority 0 for low, 1 for high

----------------------- Attachment and encoding options -----------------------
-attach &lt;file&gt;  : attach binary file(s) to message (filenames comma separated)
-attacht &lt;file&gt; : attach text file(s) to message (filenames comma separated)
-attachi &lt;file&gt; : attach text file(s) as INLINE (filenames comma separated)
-embed &lt;file&gt;   : embed file(s) in HTML.  Object tag in HTML must specify
                  content-id using cid: tag.  eg: &lt;img src="cid:image.jpg"&gt;
-af &lt;file&gt;      : file containing list of binary file(s) to attach (comma
                  separated)
-atf &lt;file&gt;     : file containing list of text file(s) to attach (comma
                  separated)
-aef &lt;file&gt;     : file containing list of embed file(s) to attach (comma
                  separated)
-base64         : send binary files using base64 (binary MIME)
-uuencode       : send binary files UUEncoded
-enriched       : send an enriched text message (Content-Type=text/enriched)
-unicode        : message body is in 16- or 32-bit Unicode format
-html           : send an HTML message (Content-Type=text/html)
-alttext &lt;text&gt; : plain text for use as alternate text
-alttextf &lt;file&gt;: plain text file for use as alternate text
-mime           : MIME Quoted-Printable Content-Transfer-Encoding
-8bitmime       : ask for 8bit data support when sending MIME
-multipart &lt;size&gt;
                : send multipart messages, breaking attachments on &lt;size&gt;
                  KB boundaries, where &lt;size&gt; is per 1000 bytes
-nomps                : do not allow multipart messages

---------------------------- NNTP specific options ----------------------------
-groups &lt;usenet groups&gt;
                : list of newsgroups (comma separated)

-------------------------------- Other options --------------------------------
-h              : displays this help (also -?, /?, -help or /help)
-q              : suppresses all output to the screen
-debug          : echoes server communications to a log file or screen
                  (overrides -q if echoes to the screen)
-log &lt;file&gt;     : log everything but usage to &lt;file&gt;
-timestamp      : when -log is used, a timestamp is added to each log line
-ti &lt;n&gt;         : set timeout to 'n' seconds.  Blat will wait 'n' seconds for
                  server responses
-try &lt;n times&gt;  : how many times blat should try to send (1 to 'INFINITE')
-binary         : do not convert ASCII | (pipe, 0x7c) to CrLf in the message
                  body
-hostname &lt;hst&gt; : select the hostname used to send the message via SMTP
                  this is typically your local machine name
-raw            : do not add CR/LF after headers
-delay &lt;x&gt;      : wait x seconds between messages being sent when used with
                  -maxnames or -multipart
-comment &lt;char&gt; : use this character to mark the start of commments in
                  options files and recipient list files.  The default is ;
-superdebug     : hex/ascii dump the data between Blat and the server
-superdebugT    : ascii dump the data between Blat and the server
-------------------------------------------------------------------------------

Note that if the '-i' option is used, &lt;sender&gt; is included in 'Reply-to:'
and 'Sender:' fields in the header of the message.

Optionally, the following options can be used instead of the -f and -i
options:

-mailfrom &lt;addr&gt;   The RFC 821 MAIL From: statement
-from &lt;addr&gt;       The RFC 822 From: statement
-replyto &lt;addr&gt;    The RFC 822 Reply-To: statement
-returnpath &lt;addr&gt; The RFC 822 Return-Path: statement
-sender &lt;addr&gt;     The RFC 822 Sender: statement

For backward consistency, the -f and -i options have precedence over these
RFC 822 defined options.  If both -f and -i options are omitted then the
RFC 821 MAIL FROM statement will be defaulted to use the installation-defined
default sender address.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://xuming.info/2007/05/1003/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

