<?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>Teh Tech &#187; Visual Basic Script (vbs)</title>
	<atom:link href="http://tehtech.com/category/visual-basic-script-vbs/feed/" rel="self" type="application/rss+xml" />
	<link>http://tehtech.com</link>
	<description>Being an Admin is Hard Enough</description>
	<lastBuildDate>Wed, 14 Jul 2010 16:14:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>How to Add and Remove a Local Account from a Group</title>
		<link>http://tehtech.com/how-to-add-and-remove-a-local-account-from-a-group/</link>
		<comments>http://tehtech.com/how-to-add-and-remove-a-local-account-from-a-group/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 20:35:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Visual Basic Script (vbs)]]></category>
		<category><![CDATA[Groups]]></category>
		<category><![CDATA[Local Admin]]></category>
		<category><![CDATA[Login Script]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=361</guid>
		<description><![CDATA[Occasionally you may need to add a local user account to the local administrators group for a software install or temporary maintenance. The following vbs script can be used to add the local â€˜user1â€™ account to the local â€˜administratorsâ€™ group. Any user can be added to any local group, change the red to match your [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally you may need to add a local user account to the local administrators group for a software install or temporary maintenance. The following vbs script can be used to add the local â€˜user1â€™ account to the local â€˜administratorsâ€™ group. Any user can be added to any local group, change the <span style="color: #ff0000;">red</span> to match your needs. The computer name is pulled from the workstation dynamically so this is also completely portable and can be run on any computer.<br />
<span id="more-361"></span></p>
<div class="box">Dim objComputer, objWSHNetwork, strComputerName, objUser, objGroup<br />
Set objWSHNetwork = WScript.CreateObject(&#8220;WScript.Network&#8221;)<br />
strComputerName = objWSHNetwork.ComputerName<br />
Set objComputer = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName)<br />
Set objGroup = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName &amp; &#8220;/<span style="color: #ff0000;">Administrators</span>&#8220;)<br />
Set objUser = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName &amp; &#8220;/<span style="color: #ff0000;">user1</span>&#8220;)<br />
objGroup.Add(objUser.ADsPath)<br />
objUser.SetInfo</div>
<p>To use this through Kaseya save the above as user1addadmin.vbs and upload it to the server:</p>
<div class="box">Script Name: Add user1 to admin group<br />
Script Description: Adds the local user1 account to the local admin group<br />
IF True<br />
THEN<br />
Write File<br />
Parameter 1 : c:\temp\user1addadmin.vbs<br />
Parameter 2 : <span style="color: #ff0000;">admin\VBS\</span>user1addadmin.vbs<br />
OS Type : 0<br />
Execute File<br />
Parameter 1 : c:\WINDOWS\system32\wscript.exe<br />
Parameter 2 : c:\temp\user1addadmin.vbs<br />
Parameter 3 : 3<br />
OS Type : 0<br />
ELSE
</div>
<p>It might also come up that you may need to remove a user from a local group. The following one line batch file can be run as a login script, batch file or ran as a shell command. It will remove the local â€˜user1â€™ account from the local â€˜administratorsâ€™ group. Again this will work for any user account and any group.Â  Just change the <span style="color: #ff0000;">red</span> to match your needs.</p>
<div class="box">net localgroup <span style="color: #ff0000;">administrators</span> <span style="color: #ff0000;">user1</span> /delete</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>Through Kaseya the following script would accomplish this:</p>
<div class="box">Script Name: Remove the local user1 from admin group<br />
Script Description: removes the local user1 account from the admin group.</p>
<p>IF True<br />
THEN<br />
Execute Shell Command<br />
Parameter 1 : NET LOCALGROUP <span style="color: #ff0000;">administrators</span> <span style="color: #ff0000;">user1</span> /delete<br />
Parameter 2 : 1<br />
OS Type : 0<br />
ELSE
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/how-to-add-and-remove-a-local-account-from-a-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Command Prompt Here Context Menu</title>
		<link>http://tehtech.com/add-command-prompt-here-context-menu/</link>
		<comments>http://tehtech.com/add-command-prompt-here-context-menu/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 15:53:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Visual Basic Script (vbs)]]></category>
		<category><![CDATA[Command Prompt]]></category>
		<category><![CDATA[Context Menu]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=237</guid>
		<description><![CDATA[Easy fast administration means less stress. This nifty script aims to save you some time.Â  This adds the right click context menu to all folders in explorer &#8216;cmd prompt here&#8217;. When you click this option a command prompt with the current directory will be displayed. This is a very useful tool for administrative functions and [...]]]></description>
			<content:encoded><![CDATA[<p>Easy fast administration means less stress. This nifty script aims to save you some time.Â  This adds the right click context menu to all folders in explorer &#8216;cmd prompt here&#8217;. When you click this option a command prompt with the current directory will be displayed. This is a very useful tool for administrative functions and saves you the time of opening a command prompt and changing directory to the folder you need. Additionally, it gives you aÂ really easy way to walk a user through openingÂ a command prompt window when you need them to run something like ipconfig over the phone. This is a visual basic script and runs silently, so it can be deployed by login script, or GPO as well as kaseya. Just save it as a .vbs.<br />
<span id="more-237"></span></p>
<div class="box">Dim WSHShell<br />
Set WSHShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br />
WSHShell.RegWrite &#8220;HKCR\Folder\Shell\MenuText\Command\&#8221;, &#8220;cmd.exe /k cd &#8221; &amp; chr(34) &amp; &#8220;%1&#8243; &amp; chr(34)<br />
WSHShell.RegWrite &#8220;HKCR\Folder\Shell\MenuText\&#8221;, &#8220;Cmd Prompt Here&#8221;</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>For Kaseya, save the above as cmd_here.vbs, and upload it to the server. Import this script and change the red location to match the location of the file on your server.</p>
<div class="box">Script Name: cmd here<br />
Script Description: Adds &#8216;cmd here&#8217; to the context menu of explorer<br />
IF True<br />
THEN<br />
Write File<br />
Parameter 1 : c:\temp\cmd_here.vbs<br />
Parameter 2 :<span style="font-family: mceinline;"> <span style="color: #ff0000;">admin\VBS\cmd_here.vbs</span></span><br />
OS Type : 0<br />
Execute File<br />
Parameter 1 : c:\WINDOWS\system32\wscript.exe<br />
Parameter 2 : c:\temp\cmd_here.vbs<br />
Parameter 3 : 3<br />
OS Type : 0<br />
ELSE
</div>
<p>
<script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/add-command-prompt-here-context-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make a Local User Account With VBS</title>
		<link>http://tehtech.com/make-a-local-user-account-with-vbs/</link>
		<comments>http://tehtech.com/make-a-local-user-account-with-vbs/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 16:16:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Visual Basic Script (vbs)]]></category>
		<category><![CDATA[User Account]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=135</guid>
		<description><![CDATA[I deployed a bunch of new computers to a network using terminal services. Since the real authentication is at the server we standardize the local computer login to the username user1 and the password user1, just to keep things simple.Â Â  SoÂ I needed a easy way to create this account locally on 30+ workstations. Here is [...]]]></description>
			<content:encoded><![CDATA[<p>I deployed a bunch of new computers to a network using terminal services. Since the real authentication is at the server we standardize the local computer login to the username user1 and the password user1, just to keep things simple.Â Â  SoÂ I needed a easy way to create this account locally on 30+ workstations. Here is whatÂ I came up with:<br />
<span id="more-135"></span></p>
<div class="box">
<p>Option Explicit<br />
&#8216; On Error Resume Next</p>
<p>Dim objComputer, objGroup, objUser, objWSHNetwork, strComputerName, FullName, Password, UserName, lngFlag<br />
Const ADS_UF_DONT_EXPIRE_PASSWD = &amp;H10000<br />
Const ADS_UF_PASSWD_CANT_CHANGE = &amp;H40<br />
Set objWSHNetwork = WScript.CreateObject(&#8220;WScript.Network&#8221;)<br />
strComputerName = objWSHNetwork.ComputerName<br />
Set objComputer = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName)<br />
Set objGroup = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName &amp; &#8220;/Users&#8221;)</p>
<p>UserName = &#8220;<span style="color: #ff0000;">user1</span>&#8221;<br />
FullName = &#8220;<span style="color: #ff0000;">user1</span>&#8221;<br />
Password = &#8220;<span style="color: #ff0000;">user1</span>&#8221;</p>
<p>Set objUser = objComputer.Create(&#8220;<span style="color: #000000;">User</span>&#8220;, UserName)<br />
objUser.SetPassword Password<br />
objUser.FullName = FullName<br />
objUser.SetInfo<br />
objGroup.Add &#8220;WinNT://&#8221; &amp; strComputerName &amp; &#8220;/&#8221; &amp; UserName</p>
<p><span style="color: #800080;">lngFlag = objUser.Get(&#8220;UserFlags&#8221;)<br />
lngFlag = lngFlag Or ADS_UF_DONT_EXPIRE_PASSWD<br />
objUser.Put &#8220;UserFlags&#8221;, lngFlag</span></p>
<p><span style="color: #800080;">lngFlag = objUser.Get(&#8220;UserFlags&#8221;)<br />
lngFlag = lngFlag Or ADS_UF_PASSWD_CANT_CHANGE<br />
objUser.Put &#8220;UserFlags&#8221;, lngFlag</span></p>
<p>objUser.SetInfo<br />
objUser.SetInfo</p></div>
<p>What this does is it creats a user account on the local computer feel free to change the <span style="color: #ff0000;">red</span> values to fit your needs. Â It also flags the password as user cannot change and never expires. Â These sections of code (marked in <span style="color: #800080;">purple</span>) can be removed to fit your needs. Â Remember visual basic scripts are hangled by wscript.exe usually found in c:windowssystem32wscript.exe.  Be sure to point the script to this if you are using it as a login script or pusing it through a third party application like kaseya.</p>
<p>here is a example of this being used in kaseya, copy the script, edit it to your needs, save it as user1.vbs, adn put it on the kaseya server.  Run it an vola, user account across a network.</p>
<div class="box">Script Name: User Account Creation<br />
Script Description: Creats an account called user1 with the password user1 and sets it to never expire and user cannot change.Â Â </p>
<p>IF True<br />
THEN<br />
Write File<br />
Parameter 1 : c:tempuser1.vbs<br />
Parameter 2 : adminVBSadmin.vbs<br />
OS Type : 0<br />
Execute File<br />
Parameter 1 : c:WINDOWSsystem32wscript.exe<br />
Parameter 2 : c:tempuser1.vbs<br />
Parameter 3 : 3<br />
OS Type : 0<br />
ELSE
</p></div>
<p>Hope this helps, it took me a while toÂ develop.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/make-a-local-user-account-with-vbs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reset a Local Account Password With VBS</title>
		<link>http://tehtech.com/reset-a-local-account-password-with-vbs/</link>
		<comments>http://tehtech.com/reset-a-local-account-password-with-vbs/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:25:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Visual Basic Script (vbs)]]></category>
		<category><![CDATA[Password reset]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=75</guid>
		<description><![CDATA[Today I added a bunch of old computers with different local admin account passwords to our domain.Â  So, since I am all for doing things the easy way I came up with a quick script.Â  I added the computers that I needed the admin account reset on to an active directory OU and applied this [...]]]></description>
			<content:encoded><![CDATA[<p>Today I added a bunch of old computers with different local admin account passwords to our domain.Â  So, since I am all for doing things the easy way I came up with a quick script.Â  I added the computers that I needed the admin account reset on to an active directory OU and applied this script.<br />
<span id="more-75"></span></p>
<div class="box">Option Explicit<br />
&#8216; On Error Resume Next<br />
Dim objComputer, objWSHNetwork, strComputerName, objUser<br />
Set objWSHNetwork = WScript.CreateObject(&#8220;WScript.Network&#8221;)<br />
strComputerName = objWSHNetwork.ComputerName<br />
Set objComputer = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName)<br />
Set objUser = GetObject(&#8220;WinNT://&#8221; &amp; strComputerName &amp; &#8220;/<span style="font-family: mceinline;"><span style="color: #ff0000;">accountname</span></span>, user&#8221;)<br />
objUser.SetPassword &#8220;<span style="font-family: mceinline;"><span style="color: #ff0000;">password</span></span>&#8221;<br />
objUser.SetInfo</div>
<p>If you would like to use this with Kaseya all you have to do is copy the above script name and name it password.vbs. Change the variables to meet your needs and then upload it to the server.Â  Then just import the script below and change the path of the password.vbs to match the path of your file.</p>
<div class="box">Script Name: Password Reset<br />
Script Description: This resets an account password to a password of your choice with no intervention from the user.<br />
THEN<br />
Write File<br />
Parameter 1 : c:temppassword.vbs<br />
Parameter 2 : adminVBSpassword.vbs<br />
OS Type : 0<br />
Execute File<br />
Parameter 1 : c:WINDOWSsystem32wscript.exe<br />
Parameter 2 : c:temppassword.vbs<br />
Parameter 3 : 3<br />
OS Type :</div>
<p>This script pulls the computer name from the computer so it is completely portable.Â  This can also be used to reset any local accounts not just admin accounts and can be pushed through active directory or another script management application like Kaseya or n-able.Â  Remember that wscript.exe is what handles .vbs in windows, so be sure to point the script to the right location (usually c:windowssystem32wscript32.exe).Â  Just change the above <span style="color: #ff0000;">accountname</span> to match the account you wish to reset and insert the <span style="color: #ff0000;">password</span> you wish to set it to.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/reset-a-local-account-password-with-vbs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

