 




<?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>The VBScript Network and Systems Administrator&#039;s Cafe &#187; Development</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 18:36:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>VBScript Statements: Explanation of the Execute Statement</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-execute-statement/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-execute-statement/#comments</comments>
		<pubDate>Mon, 04 May 2009 17:10:38 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[execute]]></category>
		<category><![CDATA[execute statement]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Statements]]></category>
		<category><![CDATA[vbscriptstatements]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=47</guid>
		<description><![CDATA[The VBScript Execute statement allows you to execute a series of VBScript statements as a block from within a VBScript Script. By itself it doesn&#8217;t sound terribly appealing&#8230; after all, Executing a series of VBScript statements is what you do inside a VBScript file. However, if you consider that you can load the statements from [...]]]></description>
				<content:encoded><![CDATA[<p>The VBScript Execute statement allows you to execute a series of VBScript statements as a block from within a VBScript Script. By itself it doesn&#8217;t sound terribly appealing&#8230; after all, Executing a series of VBScript statements is what you do inside a VBScript file.</p>
<p>However, if you consider that you can load the statements from another file, it becomes somewhat interesting because it could allow you to share code between scripts or add funtionality like some applications that allow scripting inside the application.</p>
<p>The syntax of the Execute Statement is simply as follows:</p>
<blockquote>
<pre><strong>Execute </strong><em>statement</em></pre>
</blockquote>
<p>Statement can be a series of commands enclosed in quotes, with each command separated with a colon (:) or a variable that contains a string that is the commands you wish to execute.</p>
<p>For More information on this statement, check out <a href="http://msdn.microsoft.com/en-us/library/03t418d2(VS.85).aspx" target="_blank">Microsoft&#8217;s documentation here</a>.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-execute-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the VBScript datediff function to determine the age of a file by the last modified and the last accessed time</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/#comments</comments>
		<pubDate>Sat, 02 May 2009 18:19:29 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Disk space]]></category>
		<category><![CDATA[disk utilities]]></category>
		<category><![CDATA[file access]]></category>
		<category><![CDATA[file modified]]></category>
		<category><![CDATA[modification date]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=245</guid>
		<description><![CDATA[I recently needed a way to tell if a file had been accessed or modified recently, something that has always been a question when you&#8217;re out of space on a server and can&#8217;t just add more space to it. What do you delete??? The Old files are the obvious answer&#8230; except if people are using them. Here [...]]]></description>
				<content:encoded><![CDATA[<p>I recently needed a way to tell if a file had been accessed or modified recently, something that has always been a question when you&#8217;re out of space on a server and can&#8217;t just add more space to it. What do you delete??? The Old files are the obvious answer&#8230; except if people are using them.</p>
<p>Here is teh script I wrote to tell if a file had been accessed or modified in the last X days. In the example I use 5 days, but you can use a different number of days when you call the function.</p>
<p>Enjoy!</p>
<p><span style="color: #0000ff">Option Explicit</span></p>
<p><span style="color: #0000ff">Dim fName<br />
Const DateLastModified = 1, DateLastAccessed = 2</span></p>
<p><span style="color: #0000ff">fName=&#8221;c:\temp2.txt&#8221;</span></p>
<p><span style="color: #0000ff">if FileAge(fname,5,DateLastAccessed) = True Then<br />
WScript.Echo (&#8220;The file was accessed recently enough!&#8221;)<br />
Else<br />
WScript.Echo (&#8220;The file was not accessed recently enough!&#8221;)<br />
End If</span></p>
<p><span style="color: #0000ff">if FileAge(fname,5,DateLastModified) = True Then<br />
WScript.Echo (&#8220;The file was modified recently!&#8221;)<br />
Else<br />
WScript.Echo (&#8220;The file was not modified recently!&#8221;)<br />
End If</span></p>
<p><span style="color: #0000ff">Function FileAge(fName,fAge, CompareType)<br />
&#8216;function returns True if the file is older than the fAge (File Age) specified and false if it isn&#8217;t<br />
Dim LastModified, LastAccessed, FSO, DateDifference</span></p>
<p><span style="color: #0000ff"> Set FSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
LastModified = FSO.GetFile(fname).DateLastModified<br />
LastAccessed = FSO.GetFile(fname).DateLastAccessed</span></p>
<div><span style="color: #0000ff"> Select Case CompareType<br />
Case 1<br />
DateDifference = DateDiff(&#8220;n&#8221;,LastModified, Now())<br />
Case 2<br />
DateDifference = DateDiff(&#8220;n&#8221;,LastAccessed, Now())</p>
<div><span style="color: #0000ff"> End Select<br />
If DateDifference &gt; fage Then<br />
FileAge = False<br />
Else<br />
FileAge = True<br />
End If<br />
End Function</span></div>
<p></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<p><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing the Windows Event log for specific data</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/parsing-the-windows-event-log-for-specific-data/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/parsing-the-windows-event-log-for-specific-data/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 13:44:42 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Eventlogs]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Win32_NTLogEvent]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=106</guid>
		<description><![CDATA[If you&#8217;ve ever tried to find a specific event log entry in a system you know what a chore it can be to find them. Sure, you can filter on the event ID and get closer but, some applications (and system components) log every event that&#8217;s from the same source as the same event ID. [...]]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;ve ever tried to find a specific event log entry in a system you know what a chore it can be to find them. Sure, you can filter on the event ID and get closer but, some applications (and system components) log every event that&#8217;s from the same source as the same event ID.</p>
<p>IIS is terribly bad about this! Additionally, Microsoft&#8217;s search filtering isn&#8217;t powerful enough to search in the even description or the event message. The script below solves that problem!</p>
<p><span style="color: #0000ff">GetLogInfo &#8220;ServerName&#8221;,&#8221;EventID&#8221;, &#8220;application&#8221;, &#8220;20081218&#8243;</span></p>
<p><span style="color: #0000ff">Function GetLogInfo( StrComputer1, EventID, EventLogType, YYYYMMDD)</span></p>
<p><span style="color: #0000ff"> Dim objWMIService, colItems, objItem<br />
 Dim TempStr</span></p>
<p><span style="color: #0000ff"> On Error Resume Next<br />
  &#8216; error control block<br />
  Set objWMIService = GetObject(&#8220;winmgmts:{impersonationLevel=impersonate}//&#8221; &amp; strComputer1 &amp; &#8220;\root\cimv2&#8243;)<br />
  Set colItems = objWMIService.ExecQuery (&#8220;Select * from Win32_NTLogEvent Where EventCode=&#8221; &amp; EventID &amp; &#8221; and logfile=&#8217;&#8221; &amp; EventlogType &amp; &#8220;&#8216;&#8221;)<br />
  For Each objItem in colItems<br />
       TempStr = &#8220;&#8221;<br />
       If mid(objItem.timegenerated,1,8) = YYYYMMDD Then<br />
         TempStr = objItem.message         <br />
         If Replace(TempStr,&#8221;Exception message: Request timed out.&#8221;,&#8221;") &lt;&gt; TempStr Then <br />
            TempStr = Mid(TempStr,InStr(1,TempStr,&#8221;Request URL: &#8220;)+13, 100)<br />
            TempStr = Mid(TempStr,1,InStr(1,TempStr,&#8221;.aspx&#8221;)+4)<br />
            WScript.Echo StrComputer1 &amp; &#8220;,&#8221; &amp; TempStr<br />
         End if<br />
       End if<br />
  Next<br />
 On Error GoTo 0<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/parsing-the-windows-event-log-for-specific-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding the owner of a process remotely with VBScript via the Win32_process class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/finding-the-owner-of-a-process-remotely-with-vbscript-via-the-win32_process-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/finding-the-owner-of-a-process-remotely-with-vbscript-via-the-win32_process-class/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 15:18:13 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Administration tools]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>
		<category><![CDATA[win32_process]]></category>
		<category><![CDATA[Windows Management Interface]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=292</guid>
		<description><![CDATA[ Recently I had an issue where I needed to find the user running a series of processes on a large number of servers. Initially, it was a long process of logging onto each server then opening task manager and sorting by process name. After about 5 servers, I realized it was going to take hours [...]]]></description>
				<content:encoded><![CDATA[<p> Recently I had an issue where I needed to find the user running a series of processes on a large number of servers. Initially, it was a long process of logging onto each server then opening task manager and sorting by process name. After about 5 servers, I realized it was going to take hours to sort out the users running the processes&#8230; so I spent 30 minutes not preforming this process and wrote a script to do the rest of the work in less than a minute!</p>
<p>The function below uses the Win32_Process WMI class to enumerate processes running on a server that are named the same as the process name you give it. It then outputs the name of the user running the process.</p>
<p>Below is the function&#8230; Enjoy!</p>
<p> <span style="color: #0000ff">Function FindProcessOwner( StrComputer1, ProcessName)</span></p>
<p><span style="color: #0000ff">Dim objWMIService, colItems, objItem, Username, Domain</span></p>
<p><span style="color: #0000ff">On Error Resume Next<br />
&#8216; error control block<br />
Set objWMIService = GetObject(&#8220;winmgmts:{impersonationLevel=impersonate}//&#8221; &amp; strComputer1 &amp; &#8220;\root\cimv2&#8243;)<br />
If Err.Number &lt;&gt; 0 Then<br />
WScript.Echo &#8220;An Error Occured (&#8221; &amp; StrComputer1 &amp; &#8220;): &#8221; &amp; Err.Description<br />
End If<br />
Set colItems = objWMIService.ExecQuery (&#8220;Select * from Win32_Process Where Name = &#8216;&#8221; &amp; ProcessName &amp; &#8220;&#8216;&#8221;)<br />
WScript.Echo &#8220;Searching for processes on &#8221; &amp; StrComputer1 &amp; &#8220;.&#8221;<br />
WScript.Echo colItems.count &amp; &#8221; processes found.&#8221;<br />
For Each objItem in colItems<br />
objItem.getowner Username, Domain<br />
FindProcessOwner = FindProcessOwner &amp; VbCrLf &amp; strComputer1 &amp; &#8220;: &#8221; &amp; objItem.name &amp;_<br />
&#8220;(PID: &#8221; &amp; objItem.processid &amp; &#8220;) the owner is: &#8221; &amp; Domain &amp; &#8220;\&#8221; &amp; Username<br />
Next<br />
On Error GoTo 0<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/finding-the-owner-of-a-process-remotely-with-vbscript-via-the-win32_process-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying IP Address settings with WMI via the Win32_NetworkAdapterConfiguration class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-ip-address-settings-with-wmi-via-the-win32_networkadapterconfiguration-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-ip-address-settings-with-wmi-via-the-win32_networkadapterconfiguration-class/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 16:23:23 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=269</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the IP address settings for the network cards installed in a system.</p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<p><span style="color: #0000ff">Function GetIPAddresses(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService<br />
Dim IP</span></p>
<p><span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48) </span></p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
For Each address In objItem.ipaddress<br />
IP = replace(address,&#8221;:&#8221;,&#8221;")<br />
&#8216;IP = Replace(IP,vbnull,&#8221;No IP Assigned&#8221;)<br />
GetIPAddresses = GetIPAddresses &amp; vbTab &amp; mid(objItem.caption,InStr(objItem.caption,&#8221;]&#8221;)+2) &amp; &#8220;: &#8221; &amp; IP &amp; vbcrLF<br />
Next<br />
Next<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-ip-address-settings-with-wmi-via-the-win32_networkadapterconfiguration-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying Operating System Information with WMI via the Win32_OperatingSystem class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-operating-system-information-with-wmi-via-the-win32_operatingsystem-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-operating-system-information-with-wmi-via-the-win32_operatingsystem-class/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:23:21 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=263</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the operating system and service pack information installed on a system.</p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<p><span style="color: #0000ff">Function GetOSVersion(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService<br />
GetOSVersion = VbCrLf<span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_OperatingSystem&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48)</p>
<p></span></span></p>
<p> </p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
GetOSVersion = GetOSVersion &amp; vbTab &amp; replace(objItem.caption,&#8221;(R)&#8221;,&#8221;") &amp; VbCrLf<br />
GetOSVersion = GetOSVersion &amp; vbTab &amp; &#8220;Service Pack &#8221; &amp; objitem.ServicePackMajorVersion &amp; VbCrLf<br />
Next<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-operating-system-information-with-wmi-via-the-win32_operatingsystem-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying Page File information with WMI via the Win32_Pagefile class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-page-file-information-with-wmi-via-the-win32_pagefile-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-page-file-information-with-wmi-via-the-win32_pagefile-class/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 13:23:07 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=264</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the total page file space allocated in a system.</p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<p><span style="color: #0000ff">Function GetPageFile(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService<br />
GetPageFile = VbCrLf<span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_PageFile&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48)</p>
<p></span></span></p>
<p> </p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
GetPageFile = GetPageFile &amp; vbTab &amp; ((objItem.filesize/1024)/1024) &amp; &#8221; Mb&#8221; &amp; vbcrlf<br />
Next<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-page-file-information-with-wmi-via-the-win32_pagefile-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying Memory information via WMI using the Win32_PhysicalMemory class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-memory-information-via-wmi-using-the-win32_physicalmemory-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-memory-information-via-wmi-using-the-win32_physicalmemory-class/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 13:22:58 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=265</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the total amount of physical memory in a system.</p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<p><span style="color: #0000ff">Function GetPhysicalMemory(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService, RAM<br />
GetPhysicalMemory = VbCrLf<br />
RAM = 0</span></p>
<p><span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_PhysicalMemory&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48) </span></p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
RAM = RAM + objItem.capacity<br />
Next<br />
GetPhysicalMemory = GetPhysicalMemory &amp; vbTab &amp; (((RAM/1024)/1024)/1024) &amp; &#8221; Gb&#8221; &amp; VbCrLf<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-memory-information-via-wmi-using-the-win32_physicalmemory-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying Processor information with WMI via the Win32_Processor class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-processor-information-with-wmi-via-the-win32_processor-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-processor-information-with-wmi-via-the-win32_processor-class/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:13:53 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=266</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the Processor information in the system and teh number of processors in the system. <em>(<strong>Note</strong>: At this time I don&#8217;t have a dual core system to test it with, I believe that it will diplay the number of cores in the system. So, 4 dual core processors will be displayed as 8 processors/cores.)</em></p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<div><span style="color: #0000ff">Function GetCPUs(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService<br />
Dim Cores<span style="color: #0000ff">Cores = 0</span></span></div>
<p><span style="color: #0000ff"><span style="color: #0000ff"> </p>
<p></span></span></p>
<p> </p>
<p><span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_Processor&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48) </span></p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
If Replace(objItem.name,&#8221;GHz&#8221;,&#8221;") = objItem.name then<br />
GetCPUs =(round(objItem.CurrentClockSpeed/1024,1)) &amp; &#8220;GHz&#8221; &amp; &#8221; &#8221; &amp; objItem.name &amp; VbCrLf<br />
Else<br />
GetCPUs = objItem.name &amp; VbCrLf<br />
end if<br />
Cores = Cores + 1<br />
Next<br />
GetCPUs =  vbTab &amp; Cores &amp; &#8221; Processors/Cores that are: &#8221; &amp; GetCPUs<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-processor-information-with-wmi-via-the-win32_processor-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a BGINFO like Script: Displaying MAC Address information with WMI via the Win32_NetworkAdapter class</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-mac-address-information-with-wmi-via-the-win32_networkadapter-class/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-mac-address-information-with-wmi-via-the-win32_networkadapter-class/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:49:51 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[bginfo]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Systems administrator tools]]></category>
		<category><![CDATA[systems management]]></category>
		<category><![CDATA[systems reporting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=268</guid>
		<description><![CDATA[I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it. The function below is [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to provide the information displayed with <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx" target="_blank">BGINFO</a> on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.</p>
<p>The function below is a part of the script I mentioned. It retrieves and returns text that represents the total space and the total free space on all the physical hard drives in a system.</p>
<p>You can view all the scripts in this <a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/bginfo/">BGINFO series here</a>.</p>
<p>Here is the code:</p>
<p><span style="color: #0000ff">Function GetMACAddress(strComputer)<br />
Dim colItems, objItem, address<br />
Dim StrQuery<br />
Dim objWMIService</span></p>
<p><span style="color: #0000ff">StrQuery = &#8220;SELECT * FROM Win32_NetworkAdapter&#8221;<br />
Set objWMIService = GetObject(&#8220;winmgmts:\\&#8221; &amp; strComputer &amp; &#8220;\root\CIMV2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(strQuery,,48) </span></p>
<p><span style="color: #0000ff">For Each objItem in colItems<br />
if objitem.MACAddress &lt;&gt; vbnull Then<br />
GetMACAddress = GetMACAddress &amp; vbTab &amp; objItem.name &amp; &#8220;: &#8221; &amp; objItem.MACAddress &amp; VbCrLf<br />
End If<br />
Next<br />
End Function</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-a-bginfo-like-script-displaying-mac-address-information-with-wmi-via-the-win32_networkadapter-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
