<?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.0</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>[ad]</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>[ad]</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 />
[ad]</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>[ad]</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>
