<?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; User Account</title>
	<atom:link href="http://tehtech.com/tag/user-account/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>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>
	</channel>
</rss>

