<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Petri IT Knowledgebase Forums - General Scripting</title>
		<link>http://www.petri.co.il/forums/</link>
		<description>Scripting (most languages are supported) issues.</description>
		<language>en</language>
		<lastBuildDate>Fri, 24 May 2013 02:09:00 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.petri.co.il/forums/images/steelblue/misc/rss.jpg</url>
			<title>Petri IT Knowledgebase Forums - General Scripting</title>
			<link>http://www.petri.co.il/forums/</link>
		</image>
		<item>
			<title>For /F command only opens .TXT file</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=63407&amp;goto=newpost</link>
			<pubDate>Sat, 11 May 2013 15:06:53 GMT</pubDate>
			<description><![CDATA[Hello all, 
 
Posting in here because this is a scripting question, but also posted in the AD forum due to it's relation to AD (dsmove command). Please forgive the double posts 
 
I'm devising some dsquery / dsmove commands , just experimenting around. 
 
I'm experimenting with using for /f command...]]></description>
			<content:encoded><![CDATA[<div>Hello all,<br />
<br />
Posting in here because this is a scripting question, but also posted in the AD forum due to it's relation to AD (dsmove command). Please forgive the double posts<br />
<br />
I'm devising some dsquery / dsmove commands , just experimenting around.<br />
<br />
I'm experimenting with using for /f command to parse each line of .txt file. The .txt file contains the DN of the objects I want to move.<br />
<br />
However, all that happens is the .TXT file opens. It sits there, then I close it, and the command completes, but nothing's been moved in AD<br />
<br />
Here's my command<br />
<br />
for /f &quot;Tokens=* delims=&quot; %a in ('%userprofile%\desktop\8months.txt') do ('dsmove &quot;%a&quot; -newparent &quot;OU=8months,OU=oldcomp,DC=office,DC=local&quot;')</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>TOMJLAEL</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=63407</guid>
		</item>
		<item>
			<title>logon script to capture my docs</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=63169&amp;goto=newpost</link>
			<pubDate>Thu, 11 Apr 2013 13:42:57 GMT</pubDate>
			<description><![CDATA[So I guess after all, Google is not my friend :cry: 
 
Here is the current logon script: 
 
net use k: "\\IP ADDRESS HIDDEN\gbh" 
K:\bginfo\BgInfo.exe K:\bginfo\Capture.bgi /accepteula /timer 
net use K: /delete 
 
 
So as you see, everytime any user login or logoffs; BgInfo captures the time and...]]></description>
			<content:encoded><![CDATA[<div>So I guess after all, Google is not my friend :cry:<br />
<br />
Here is the current logon script:<br />
<br />
net use k: &quot;\\IP ADDRESS HIDDEN\gbh&quot;<br />
K:\bginfo\BgInfo.exe K:\bginfo\Capture.bgi /accepteula /timer<br />
net use K: /delete<br />
<br />
<br />
So as you see, everytime any user login or logoffs; BgInfo captures the time and date &amp; puts it in an excel spreadsheet.<br />
<br />
I'd like to also write an IF statement (or similar) so that when my 20 users log in it will use this same logon.bat file.<br />
<br />
I've tried : <br />
robocopy %userprofile%\Documents\ \\fileserver\username$ /E /R:2 /NP /XJ <br />
<br />
As you can see i have $ at the end of username to hide documents for all other users.  On the backend on the file server, All usernames have been set up using their logon credentials (example: Doe, John would be <a href="mailto:jdoe@example.com">jdoe@example.com</a>)<br />
We also have an echo turned off but that is pretty simple to implement so I decided to leave it out of this forum.<br />
<br />
Hope i haven't confused you. The purpose of this is to save All Users My Documents to the file server for compliance &amp; company data. USERS WILL NOT BE USING THESE FOLDERS so folder redirection is not needed.<br />
<br />
Thanks so much in advance.</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>gbhawk</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=63169</guid>
		</item>
		<item>
			<title>Need a script to find the account expire dates for alll users</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=63139&amp;goto=newpost</link>
			<pubDate>Wed, 10 Apr 2013 13:25:46 GMT</pubDate>
			<description>Hi I would need a script for listing the users with their account expiration dates 
If possible tell me how to export the results to excel too 
 
thanks 
Sidhin</description>
			<content:encoded><![CDATA[<div>Hi I would need a script for listing the users with their account expiration dates<br />
If possible tell me how to export the results to excel too<br />
<br />
thanks<br />
Sidhin</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>sidhinks</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=63139</guid>
		</item>
		<item>
			<title>Copy URL Link to Specific User Desktops</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=63138&amp;goto=newpost</link>
			<pubDate>Wed, 10 Apr 2013 13:09:32 GMT</pubDate>
			<description><![CDATA[I am posting very, very tired so there is likely to be missing information galor.  Can't even find the bloody script I was using that i save to a USB. 
  
Created a BAT file and inserted something like: 
  
 
Code: 
--------- 
xcopy \\servername\sharename (file://servername/sharename) "The Reading...]]></description>
			<content:encoded><![CDATA[<div>I am posting very, very tired so there is likely to be missing information galor.  Can't even find the bloody script I was using that i save to a USB.<br />
 <br />
Created a BAT file and inserted something like:<br />
 <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">xcopy <a href="file://servername/sharename" target="_blank">\\servername\sharename</a> &quot;The Reading Eggs&quot; c:\users\username\desktop</code><hr />
</div>I have tried putting quotes round the whole thing but I am missing something really simple.  The Reading Eggs is the shortcut I crearted by draging the URL from the browser to the desktop.  I have tried to deploy it using a GPO linked to the Machine and NOT the User.  I can't check the User end for a result because the previous tech locked the User Desktop and everything down.  Can't remove them as it was on a previous DC and I need to replicate what he did and try and reverse it.  Is going to be easier to reimage every machine but I want to see how I have screwed the script.<br />
 <br />
A simple line and I can't see what I have missed and I have done this successfully on previous ocassions.<br />
 <br />
Thanks.</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>biggles77</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=63138</guid>
		</item>
		<item>
			<title>security log file export required</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=63075&amp;goto=newpost</link>
			<pubDate>Wed, 03 Apr 2013 06:11:54 GMT</pubDate>
			<description>Hi Gurus 
 
I am new to this forum, so apologies in advance if I this sounds like a stupid question. I have a requirement which I am trying to solve using.  
What I want to do is collect the security logs from all the servers in the domain, that are listed in a file and save the logs, with unique...</description>
			<content:encoded><![CDATA[<div>Hi Gurus<br />
<br />
I am new to this forum, so apologies in advance if I this sounds like a stupid question. I have a requirement which I am trying to solve using. <br />
What I want to do is collect the security logs from all the servers in the domain, that are listed in a file and save the logs, with unique names on to a folder. Can this be achieved by any existing utility or with a script? If you can please get me a script that will be great. I am not very good with vbs and hence is struggling. My environment contains a mixture of 2003/2008 servers and there are approximately 100 servers so I don't particularly fancy going into each server and then saving the log. That will take a long time. I want to save the logs in the .evt and .evtx format. Is it a possibility at all?<br />
<br />
Any help will be greatly appreciated!!!<br />
Thanks in advance.<br />
<br />
Regards</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>dips</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=63075</guid>
		</item>
		<item>
			<title>adjust RDP properties - for my Project</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=62998&amp;goto=newpost</link>
			<pubDate>Fri, 22 Mar 2013 22:08:38 GMT</pubDate>
			<description>I need a little help to put some VB scripts (or any other scripting language) together for my project. 
  
  
My project is to: 
  
1. Find the IP address of the current machine. 
  
2. Make a shortcut of a RDC (Remote Desktop Connection) from that IP + 100 (i.e: If the IP address of my machine is...</description>
			<content:encoded><![CDATA[<div>I need a little help to put some VB scripts (or any other scripting language) together for my project.<br />
 <br />
 <br />
My project is to:<br />
 <br />
1. Find the IP address of the current machine.<br />
 <br />
2. Make a shortcut of a RDC (Remote Desktop Connection) from that IP + 100 (i.e: If the IP address of my machine is 172.16.9.10, then the IP on the shortcut will be 172.16.9.110. If the IP address of the machine is 172.16.9.200 then the IP on the RDC short cut will be 172.16.10.55 and so on)<br />
 <br />
3. Adjust the properties of RDC<br />
 <br />
    a. Open RDC to display as Full Screen<br />
    b. Adjust display color to &quot;High Color (24 bit)&quot;<br />
    c. Hide the &quot;Connection Bar&quot; when use Full Screen<br />
    d. Adjust experience to &quot;LAN (10Mbs or higher)<br />
 <br />
==================================<br />
 <br />
Here are the scripts that I have<br />
 <br />
1. Get IP Address and output to a file (working)<br />
 <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">On Error Resume Next<br />
Dim WSH, FSO, RunIPConfig, TempDir, CMD, OpenFile, AllText, IntStr1, IntCounter<br />
Dim FileExist, IPText, IntStr2, IPStart, IPEnd, IPDiff, IPAddress, StartPos, IntStr3, IPAddress1<br />
Dim strComputerName, FinalIP<br />
Set WSH = WSCript.CreateObject(&quot;WScript.Shell&quot;)<br />
Set WshNtwk = WScript.CreateObject(&quot;WScript.Network&quot;)<br />
Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)<br />
TempDir = WSH.ExpandEnvironmentStrings(&quot;%TEMP%&quot;)<br />
CMD = WSH.ExpandEnvironmentStrings(&quot;%Comspec% /C&quot;)<br />
StartPos = 1<br />
' Silently run ipconfig; output to temporary file<br />
RunIPConfig = WSH.run(CMD &amp; &quot; Ipconfig &gt; %TEMP%\000001.tmp&quot;, 0, True)<br />
WSCript.Sleep 200<br />
FileExist = FSO.FileExists(TempDir &amp; &quot;\000001.tmp&quot;)</code><hr />
</div>2. Make a shortcut of a RDC  (working)<br />
 <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot; )<br />
strStartup = WshShell.SpecialFolders(&quot;C:\Users\administrator\Desktop&quot; )<br />
set oShellLink = WshShell.CreateShortcut(strStartup &amp; &quot;\Users\administrator\Desktop\0900 Start.lnk&quot; )<br />
oShellLink.TargetPath = &quot;%windir%\system32\mstsc.exe&quot;<br />
oShellLink.WindowStyle = 1<br />
oShellLink.IconLocation = &quot;%windir%\system32\mstsc.exe&quot;<br />
oShellLink.Description = &quot;TESTING&quot;<br />
oShellLink.WorkingDirectory = &quot;%windir%\system32&quot;<br />
oShellLink.Save</code><hr />
</div>+++++++++++++++++++++++++++++++++++<br />
+ Still Missing the IP + 100 to the RDC short cut  +<br />
+++++++++++++++++++++++++++++++++++<br />
 <br />
3. Still missing commands to adjust the RDC' properties<br />
 <br />
 <br />
Please let me know. Thank you everyone.</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>pdiep</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=62998</guid>
		</item>
		<item>
			<title>add AD user to local admins group on multiple servers</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=62853&amp;goto=newpost</link>
			<pubDate>Mon, 04 Mar 2013 17:43:27 GMT</pubDate>
			<description><![CDATA[Hi, 
I need to add AD user to local admins group on multiple servers. 
 
I found this: 
 
" Needed to add a user to the local administrators on 16 citrix servers, below is the code if you need it. 
*psexec @servers.txt cmd /c “net localgroup Administrators /add domain\username”* 
this doesnt work...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I need to add AD user to local admins group on multiple servers.<br />
<br />
I found this:<br />
<br />
&quot; Needed to add a user to the local administrators on 16 citrix servers, below is the code if you need it.<br />
<b>psexec @servers.txt cmd /c “net localgroup Administrators /add domain\username”</b><br />
this doesnt work with multiple usernames at one time.<br />
get psexec here: <a href="http://www.sysinternals.com/" target="_blank">http://www.sysinternals.com</a><br />
servers.txt is a text file containing a list of servers, i.e:<br />
server1<br />
server2<br />
etc &quot;<br />
<br />
But when run it, I get the error (see below). <br />
When run only &quot;net localgroup Administrators /add domaine\hpsim&quot; on the same pc, the command executed successfully. Why it complains about &quot;net&quot; command?<br />
<br />
I guess no need to translate the error message from French :)<br />
<br />
C:\addadmin&gt;psexec @servers.txt cmd /c &quot;net localgroup Administrators /add domaine\hpsim&quot;<br />
PsExec v1.98 - Execute processes remotely<br />
Copyright (C) 2001-2010 Mark Russinovich<br />
Sysinternals - <a href="http://www.sysinternals.com/" target="_blank">www.sysinternals.com</a><br />
<a href="file://xxx00s22666/" target="_blank">\\xxx00s22666</a>:<br />
'&quot;net' n'est pas reconnu en tant que commande interne<br />
ou externe, un programme exécutable ou un fichier de commandes.<br />
cmd exited on csssjr00s22666 with error code 1.</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>mla</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=62853</guid>
		</item>
		<item>
			<title>Help wil parse text file with vbscript</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=62715&amp;goto=newpost</link>
			<pubDate>Sat, 16 Feb 2013 23:27:08 GMT</pubDate>
			<description>I have a text file with 10,000 + lines of data. The data is in the following format. 
 
20091228 050036;78349;1 
 
The first 8 are the date.  
 
I would like to perform the following 
 
1) read and process all lines in the source text file 
2) Set a variable in the script for the day of the week...</description>
			<content:encoded><![CDATA[<div>I have a text file with 10,000 + lines of data. The data is in the following format.<br />
<br />
20091228 050036;78349;1<br />
<br />
The first 8 are the date. <br />
<br />
I would like to perform the following<br />
<br />
1) read and process all lines in the source text file<br />
2) Set a variable in the script for the day of the week (ie Monday)<br />
3) Analyze each line of the source and determine if the date is a Monday<br />
4) if date is a Monday copy that entire line into another text file <br />
5) if date is not a Monday go to the next line<br />
<br />
Thanks in advance for the help</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>thepcmd</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=62715</guid>
		</item>
		<item>
			<title>Script does not run when server is disconnected</title>
			<link>http://www.petri.co.il/forums/showthread.php?t=62678&amp;goto=newpost</link>
			<pubDate>Tue, 12 Feb 2013 00:27:49 GMT</pubDate>
			<description><![CDATA[I have an AutoIT script that only runs when logged on. 
As soon as you disconnect the RDP session, it only gets to the login screen and then stops. 
  
This is the part that is causing the issue: 
  
;Sign In 
WinWaitActive("Dispatch Manager Sign In") 
Send($Pwd & "{Enter}") 
...]]></description>
			<content:encoded><![CDATA[<div>I have an AutoIT script that only runs when logged on.<br />
As soon as you disconnect the RDP session, it only gets to the login screen and then stops.<br />
 <br />
This is the part that is causing the issue:<br />
 <br />
;Sign In<br />
WinWaitActive(&quot;Dispatch Manager Sign In&quot;)<br />
Send($Pwd &amp; &quot;{Enter}&quot;)<br />
 WinActive(&quot;classname=TMessageForm&quot;)<br />
 ;MsgBox(0,&quot;Purge Disabled Records&quot;,&quot;TMessageForm&quot;)<br />
 Send(&quot;{Enter}&quot;)<br />
; ExitDM()<br />
 <br />
 <br />
I've been told I should use WinExists and ControlSend, but have no idea how to change this script, as it was done by my predecessor, and I have very little knowledge of scripting.</div>

]]></content:encoded>
			<category domain="http://www.petri.co.il/forums/forumdisplay.php?f=18">General Scripting</category>
			<dc:creator>krokkie</dc:creator>
			<guid isPermaLink="true">http://www.petri.co.il/forums/showthread.php?t=62678</guid>
		</item>
	</channel>
</rss>
