<?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; Login Script</title>
	<atom:link href="http://tehtech.com/tag/login-script/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>Change your Power Options to &#8216;Always On&#8217;</title>
		<link>http://tehtech.com/change-your-power-options-to-always-on/</link>
		<comments>http://tehtech.com/change-your-power-options-to-always-on/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 07:31:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Always On]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Login Script]]></category>
		<category><![CDATA[Power Options]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=148</guid>
		<description><![CDATA[It is anoying as hell when you push out an update or a patch and a computer is off. Â This hopefully will limit this problem. Although it is impossible to keep a user fromÂ shuttingÂ down this will at least keep the computer from doing it on its own. Â This can be pushed in a batch file, [...]]]></description>
			<content:encoded><![CDATA[<p>It is anoying as hell when you push out an update or a patch and a computer is off. Â This hopefully will limit this problem. Although it is impossible to keep a user fromÂ shuttingÂ down this will at least keep the computer from doing it on its own. Â This can be pushed in a batch file, or deployed as part of a login script for rollouts, and of course through kasyea. Â Note this will only work on windows xp sp2 or higher.<br />
<span id="more-148"></span><br />
Batch or login script:</p>
<div class="box">powercfg /setactive &#8220;always on&#8221;</div>
<p>Kaseya</p>
<div class="box">Script Name: Power Option &#8211; Always onÂ </div>
<p>Script Description: Turns the computers power configuation to the &#8216;always on&#8217; setting</p>
<p>IF TrueÂ </p>
<p>THEN</p>
<p>Â Â  Execute Shell Command</p>
<p>Â Â  Â  Parameter 1 : powercfg /setactive &#8220;always on&#8221;</p>
<p>Â Â  Â  Parameter 2 : 1</p>
<p>Â Â  Â  Â  Â  OS Type : 0</p>
<p>ELSE</p>
<p>Â <br />
<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/change-your-power-options-to-always-on/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Inserting a Wait in a Batch File, Using Netstat in a Login Script</title>
		<link>http://tehtech.com/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/</link>
		<comments>http://tehtech.com/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:50:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Login Script]]></category>
		<category><![CDATA[Netstat]]></category>
		<category><![CDATA[Pause]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=91</guid>
		<description><![CDATA[So you want to pause a batch file for a few seconds.Â  Unfortunately windows doesn&#8217;t provide a very simple way of doing this.Â Â  I wanted to run &#8216;netstat -b&#8217; 25 seconds after a user logged into their computer as to give the computer enough time to start up all background applications.Â  But, there is no [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to pause a batch file for a few seconds.Â  Unfortunately windows doesn&#8217;t provide a very simple way of doing this.Â Â  I wanted to run &#8216;netstat -b&#8217; 25 seconds after a user logged into their computer as to give the computer enough time to start up all background applications.Â  But, there is no wait function in batch files.Â  Well I found a workaround.Â  If you use the &#8216;-n&#8217; argument with the ping command you can specify the amount of time to run a ping for.Â  Thus ping -n 60 127.0.0.1 will ping your local host for 60 seconds.Â  This will more or less keep the batch file at a standstill for a specified number of seconds before continuing.Â  In my case I used it for a pause in a login script.<br />
<span id="more-91"></span></p>
<div class="box">echo off<br />
title login script<br />
color 1f<br />
set name=%computername%<br />
ping -n 25 127.0.0.1<br />
echo %computername% &gt;&gt; g:\%name%.log<br />
date /T &gt;&gt; g:\%name%.log<br />
time /T &gt;&gt; g:\%name%.log<br />
netstat -b &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log</div>
<p>Â <br />
In this script the &#8216;G&#8217; Drive is a mapped drive for administration.Â  When a user logs in they will open the log stamp it with their computer name, the date and the time.Â  Then the netstat output, followed by a few lines of asterisks to separate the uses visually.Â  I have an OU with this script applied to it.Â  If I suspect a user is doing something sketchy I add them to this OU, to do a little snooping.</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/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

