The Official Scripting Guys Forum! ForumEver been to the Script Center? You know, http://technet.microsoft.com/scriptcenter/. If your answer is "yes," you know what to do. Dive in and help somebody! If your answer is "no," welcome to our fun little world! We'd recommend that you first head over to the Script Center, get your feet wet, and then come back to either ask or answer questions. We can't be everywhere at once (we know—shocking!), so we will appreciate any and all help you can give to each other to get scripting problems solved. The Microsoft Scripting Guys© 2009 Microsoft Corporation. All rights reserved.Wed, 25 Nov 2009 03:14:49 Zf802a7a2-be54-4723-86b1-0024811ea199http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b5526a74-1773-457d-8493-6cc64ea3a92ahttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b5526a74-1773-457d-8493-6cc64ea3a92aRob.Fordhttp://social.technet.microsoft.com/Profile/en-US/?user=Rob.FordProblem with user level environment variables set from VBS logon script not being available until logoff/logonHi,<br/><br/>I'm a little stuck with this problem on Windows 7. Our VBS logon script sets certain user level environment variables. On Windows XP and 2003 this works perfectly. On Windows 7, it does not. <br/><br/>Details of the problem are posted in the Windows 7 forum <a href="http://social.technet.microsoft.com/Forums/en/w7itproui/thread/b2db8f15-cf77-4f48-9f6a-5b5575684d03">here</a>. I have had no luck getting a solution there so thought I'd try in here instead :)<br/><br/>A quick overview of the problem is that when a user logs onto Windows 7 for the first time, the environment variables set by the logon script are not available until the user logs off and then on again.<br/><br/>They are set using WScript.Shell.Environment like this:<br/><br/>Set Shell = CreateObject(&quot;WScript.Shell&quot;)<br/>Set TEnv = Shell.Environment(TLevel)<br/>TEnv(TName) = TValue<br/><br/>I have even tried putting this into an in-house VB.NET DLL that sets them like this:<br/><br/><span style="font-size:x-small"> <p>Environment.SetEnvironmentVariable(VarName, VarValue, EnvironmentVariableTarget.User)</p> </span>However they are set, they appear in the Registry and Computer -&gt; Properties -&gt; Advanced -&gt; Environment Variables.<br/><br/>They just won't work!<br/><br/>Restarting explorer.exe and dwm.exe have no affect so at this stage I am guessing that this is a bug in winlogon.exe or some other parent process.<br/><br/>So, I have 2 questions:<br/><br/>1. Does anyone know how to force a refresh of user environment variables? <br/>2. Is this a bug - can someone from Microsoft comment please?<br/><br/>Remember that this problem is only seen during a first logon (or the 1st time a new variable is set I think), when the variables are set during the logon.<br/><br/>One last thing, if, after logon, I manually set a new variable, the others are then picked up, which suggests that there is a way to refresh environment variables for new processes...<br/><br/>Thanks!<br/><br/>Rob<br/><br/><br/><br/><br/><br/><br/>Tue, 24 Nov 2009 22:48:54 Z2009-11-25T03:14:49Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/4a77a398-9fae-4c30-b10b-89130d9637c2http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/4a77a398-9fae-4c30-b10b-89130d9637c2KroneMarvzhttp://social.technet.microsoft.com/Profile/en-US/?user=KroneMarvzScript to query mapped drive information from multiple computers in domainHey Scripting Guy,<br/> <br/> Good day to you and hope all is well. <br/> <br/> I'm currently conducting an audit to multiple computers in one domain. I need to get their information with regards to their mapped drive. I want to know what drive letter are they pointing to and what path are they assigning each drive letter.<br/> <br/> Hoping for your favorable response.<br/> <br/> Best Regards,<br/> -Krone-Wed, 25 Nov 2009 02:17:04 Z2009-11-25T02:17:04Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/51de27c9-c6d4-44e1-9cb4-ac32b9816b66http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/51de27c9-c6d4-44e1-9cb4-ac32b9816b66KroneMarvzhttp://social.technet.microsoft.com/Profile/en-US/?user=KroneMarvzUptime using SystemInfo | Find "Uptime" method for multiple computersHey Scripting Guy,<br/> <br/> Good day to you, my name is Krone and I got a question with regards to uptime script using the Windows SystemInfo method. Here's my simple script below.<br/> <br/> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br/> <br/> for /f %%i in (machinelist_selected.txt) do SystemInfo | Find &quot;Up Time&quot; %%i&gt;&gt;Out1.txt<br/> <br/> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br/> <br/> where: machinelist_selected.txt are the list of the machines to be queried<br/>            out1.txt should be the output where the computers being queried should be recorded.<br/> <br/> My problem is that  the script run successfully and generate an Out1.txt file on the path where the script is being saved however Out1.txt doesn't seem to provide any data recorded based on the query, in short Out1.txt is empty :(.<br/> <br/> Is there any other pipe method that could display the output properly.<br/> <br/> Also, I've no problem running the script using uptime.exe method, all works well. I'll just need to further validate and compare the results of the two methods.<br/> <br/> Hoping for your favorable response.<br/> <br/> P.S. ---&gt; this thread is migrated from <a href="http://social.technet.microsoft.com/Forums/en-US/itproxpsp/thread/d74aade1-78b7-420a-a1b8-ea5bd7c0f694">http://social.technet.microsoft.com/Forums/en-US/itproxpsp/thread/d74aade1-78b7-420a-a1b8-ea5bd7c0f694 </a> and I had just migrated it. Old thread is now okay to be deleted.<br/> <br/> -Krone-Wed, 25 Nov 2009 02:11:24 Z2009-11-25T02:11:25Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/2da50f7d-1227-41e3-a26a-bb934df47369http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/2da50f7d-1227-41e3-a26a-bb934df47369gsterlehttp://social.technet.microsoft.com/Profile/en-US/?user=gsterleNew to VBScripting - Reading a log file extracting the error line and the next line and writing an output file and also extract the last 15 lines at the end on the fileI am new to vbscripting and have the following task at hand.  I am reading a unicode log file and am trying to extract the errors from the file.  Each error line contains the word * Error * so I have figured out how to extract that line, however I would also like to exctract the next line that contains additional information about the error.  I would like to write these lines to an output file.  Also the last 15 lines of the file contain valuable summary information that I would also like to be written to the output file.  That is a constant it is always the last 15 lines.  Any hlep and our examples would be apprceciated.   Other nices to have would be the generation of a unique output file name based on the input file name and the date.Tue, 24 Nov 2009 16:54:16 Z2009-11-25T00:02:55Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/1b8944c7-e05e-4d45-9d53-91c4bd21e7bfhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/1b8944c7-e05e-4d45-9d53-91c4bd21e7bfJohn.Jinhttp://social.technet.microsoft.com/Profile/en-US/?user=John.JinIE8 HTA Print lost focusHi guys, we have a HTA software running some CRM functions like Invocing / Ordering. Under IE6 everything is OK. Recently we planned to switch over to IE8 but one of the problems is printing issue.<br/>We are using the following code to start print, the print dialog will appear and click the &quot;print&quot; button on the dialog will send the page to the printer. But immediately it jumps away to an other opened application (like Excel). <br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> <p>&quot;&lt;<span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">A</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">HREF</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">javascript: void(0);</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">ID</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">print</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">ONCLICK</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">window.print();</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt;</span></span><span style="font-size:x-small">Print</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;/</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">A</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt; &quot;</span></span></p> I also tried an other way as the following code, it still jumps away for a little while but then jumps back again.<br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> <p>&quot;&lt;</p> </span></span></span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">A</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">HREF</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">javascript: this.focus();</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">ID</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">print</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> </span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">ONCLICK</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">window.print();</span></span><span style="font-size:x-small">&quot;</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt;</span></span><span style="font-size:x-small">Print</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;/</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">A</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt;&quot;<br/><br/>Is it a bug for IE8?</span></span></span></span></span></span>Tue, 24 Nov 2009 23:46:19 Z2009-11-24T23:46:20Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ea4eb933-11e3-42ea-bc6d-cb4c77e8a55dhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ea4eb933-11e3-42ea-bc6d-cb4c77e8a55dFrank F Clark Jrhttp://social.technet.microsoft.com/Profile/en-US/?user=Frank%20F%20Clark%20JrReading a group from one domain and copying users to another group in a different domain using VBS and W2K8 SP2Hey all, <br/> <br/> I'm trying to read a group from a child domain and extract the users so that I can put them in a group with the same name in the parent domain. <br/> Here is my code so far. It reads the child domain group but I can't seem to get the users into the parent domain group. currently the names of the groups are different but will change once testing is complete.<br/> <br/> On Error Resume Next<br/> Dim strMember <br/> Set objGroup = GetObject(&quot;LDAP://cn=fo power users group,ou=fo,dc=fo,dc=CA,dc=org&quot;)<br/> objGroup.GetInfo<br/> arrMemberOf = objGroup.GetEx(&quot;member&quot;)<br/>  <br/> WScript.Echo &quot;Members:&quot;<br/> For Each strMember in arrMemberOf<br/>     WScript.echo strMember<br/> Next<br/> <br/> '' Add users to a group<br/> Const ADS_PROPERTY_APPEND = 3 <br/> <br/> Set objRootDSE = GetObject(&quot;LDAP://rootDSE&quot;)<br/> Set objContainer = GetObject(&quot;LDAP://cn=Users,&quot; &amp; _<br/>     objRootDSE.Get(&quot;defaultNamingContext&quot;))<br/> <br/> For Each strMember in arrMemberOf<br/>     Set objGroup = GetObject(&quot;LDAP://cn=fo power users group,ou=fo users,ou=fo,ou=field office,dc=CA,dc=org&quot;)<br/>     objGroup.Putex ADS_PROPERTY_APPEND, strMember,&quot;FO Power Users Group&quot;<br/>     objGroup.SetInfo <br/>     WScript.echo strMember<br/> Next<br/> WScript.Echo &quot;Done&quot;<br/> <br/> Any help would be appreciated. And yes, I have looked at the scripting forum but the copying between groups script fails. Might be 2008 issue.<br/> <br/> Thanks,<br/> <br/> FrankTue, 24 Nov 2009 20:49:49 Z2009-11-24T23:22:14Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b1d37394-5028-45c2-b60a-f6612ed5a60chttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b1d37394-5028-45c2-b60a-f6612ed5a60cNick Colyerhttp://social.technet.microsoft.com/Profile/en-US/?user=Nick%20ColyerDNS Script - PowershellI'm busy working on a script to DNS check over 300 servers.<br/> <br/> My script does the following:<br/> <br/> 1. Checks if there is a DNS record from a text file of hosts<br/> 2. Returns to an excel file, the hostname, the Hostname in DNS, the ip address and eventually i want to add aliases.<br/> <br/> My script is as follows:<br/> <br/> $erroractionpreference = &quot;SilentlyContinue&quot;<br/> $a = New-Object -comobject Excel.Application<br/> $a.visible = $True <br/> <br/> $b = $a.Workbooks.Add()<br/> $c = $b.Worksheets.Item(1)<br/> <br/> $c.Cells.Item(1,1) = &quot;Machine Name&quot;<br/> $c.Cells.Item(1,2) = &quot;DNS Entry&quot;<br/> $c.Cells.Item(1,3) = &quot;IP Address listed&quot;<br/> <br/> $d = $c.UsedRange<br/> $d.Interior.ColorIndex = 19<br/> $d.Font.ColorIndex = 11<br/> $d.Font.Bold = $True<br/> $d.EntireColumn.AutoFit($True)<br/> <br/> $intRow = 2<br/> <br/> $colComputers = get-content C:\ScriptData\activehosts.txt<br/> foreach ($strComputer in $colComputers)<br/> {<br/> $c.Cells.Item($intRow, 1) = $strComputer.ToUpper()<br/> <br/> #Resolve the host name<br/> <br/> $dnsresult = [System.Net.DNS]::GetHostEntry($strComputer)<br/> <br/> #Display information about host<br/> <br/> #Give hostname Entry in Cell2<br/> <br/> $c.Cells.Item($intRow, 2) = $dnsresult.HostName<br/> <br/> #IP listed in Cell 3<br/> <br/> $c.Cells.Item($intRow, 3) = $dnsresult.AddressList[0].IpAddressToString<br/> <br/> <br/> <br/> $intRow = $intRow + 1<br/> <br/> }<br/> $d.EntireColumn.AutoFit()<br/> <br/> It is almost working perfectly, except that if there isn't a DNS record, it seems to just populate that field with the previous dns record it had from the previous server it looked up. I'm unsure what command to use to give a false value or just to output &quot;No DNS record&quot; in the hostname column and leave the ip column blank.<br/> <br/> Any advice is appreciatedTue, 24 Nov 2009 17:23:26 Z2009-11-24T22:57:21Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/07a82e5e-aa3b-40cf-8202-0433dc467564http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/07a82e5e-aa3b-40cf-8202-0433dc467564Hari Kodungallurhttp://social.technet.microsoft.com/Profile/en-US/?user=Hari%20KodungallurRobocopy - Include directories (as opposed to Include files) option?Hello,<br/> <br/> I would like to copy only a given set of directories using robocopy. How can this be achieved? Is there an option that I am missing?<br/> <br/> Details of my requirement:<br/> - I already use robocopy to sync a large number of binary files. I use robocopy obviously because I want to copy only the files that are changed since the last copy. (something like rsync)<br/> - Almost always I can run the robocopy on the top level directory. But once in a while (very infrequently), I need to copy a few files (~100 files) from 3-4 directories. I do not want to copy anything else. Again, not all files within these 3-4 directories have changed. But I know that the files that have changed are within these directories. So again using robocopy will be ideal because it will detect and copy only the changed files.<br/> <br/> From what I see so far, there is no way to provide just these directory names to robocopy and copy the appropriate files. I will have to loop through these directories and then robocopy individual files. Is that correct? Or is there an option in robocopy that can achieve this?<br/> <br/> <br/> Many thanks,<br/> -HariTue, 14 Jul 2009 00:51:48 Z2009-11-24T22:55:06Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ecebf962-e68b-459d-8314-a279de901dcdhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ecebf962-e68b-459d-8314-a279de901dcdwein3967http://social.technet.microsoft.com/Profile/en-US/?user=wein3967Windows 7 Backup and Shutdown with PowershellI am would like to writing a Powershell script which will fire the &quot;built in&quot; backup utility in Windows 7 and shut the computer down when finished.  I am new to Powershell, and I was unable to find any sample scripts in the downloads section for this type of backup.  Since I am interested in learning Powershell, I would like to avoid using VBscript and the like.  Thank you for your help.Tue, 24 Nov 2009 22:06:22 Z2009-11-24T22:06:23Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/44fd3f1b-677b-42eb-affb-2b7f69c1ad14http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/44fd3f1b-677b-42eb-affb-2b7f69c1ad14helllmonkeyhttp://social.technet.microsoft.com/Profile/en-US/?user=helllmonkeyReading text from webpage/source code into access database, preferably with VBANot sure if this is the right place or not, so if it is in the wrong place let me know.<br/><br/>At work, we have a webpage that is hosted offisite. Its a simple site that allows residents to submit service requests for things like down trees, road kill, stuff like that. After submission, there is a tracking page that is always in the same format. The problem here is that data is stored offsite and off of our network, so we have no real way to access it other than through the limited webpage. <br/><br/>Each request is givin a request number, and that number is placed in the url, so the page is <a href="http://biglongurlforrequest=requestNumber">http://biglongurlforrequest=requestNumber</a>. I have a hyperlink field on our in house work order system, they just have to put the request number in the field, then double click to access the page. There is no security or loggin in. The problem is I have no idea how to write a webpage to a file or array, and then pull that information from the page.  My biggest hurdle is I dont know how to get the info from the file into a field in access. <br/><br/> Example from the source code:<br/>&lt;td align=&quot;left&quot;  valign=&quot;top&quot;&gt;&lt;font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;&gt;&lt;tr&gt;&lt;td align=&quot;right&quot; valign=&quot;top&quot;&gt;&lt;font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;&gt;&lt;b&gt;Comments:&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br/> &lt;td align=&quot;left&quot;  valign=&quot;top&quot;&gt;&lt;font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;&gt;<strong>Description of problem</strong>.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;<br/><br/>How would I get the bolded part into a field in a table?  If there is a better way to go about this please let me know of other options.  <br/> <br/>Or can you tell me where to look/research for this stuff.  My limit of VBA is mostly looping, if/then, and form operations.<br/><br/><br/>Thank youTue, 24 Nov 2009 21:06:56 Z2009-11-24T21:58:00Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/2487ee51-0023-4b4d-9e70-4895f9c9b99dhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/2487ee51-0023-4b4d-9e70-4895f9c9b99dlizaoreohttp://social.technet.microsoft.com/Profile/en-US/?user=lizaoreoExecuting script on a remote machine - VBScriptI'm trying to remotely run a script that will get a listing of all printers (network and local) for a specific user along with whether they are default or not.  I have a script that I can use to do this locally.  I've been able to remote computers printers, but only local printer and not default status.<br/> <br/> I tried WSH, but I ran into issues with it that may have to do with how our company's domain security is set up, something I can't change.  I tried disabling firewalls, putting myself in the admin group, and all that good stuff, but was never able to get WSHRemote to work right.Tue, 24 Nov 2009 17:27:23 Z2009-11-24T21:23:48Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9506f12b-4000-4b33-bc73-f582b9aab26ahttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9506f12b-4000-4b33-bc73-f582b9aab26aJames Troyhttp://social.technet.microsoft.com/Profile/en-US/?user=James%20TroyHow to identify a junction in VBscript?<span style="font-size:x-small;font-family:Courier"><span style="font-size:x-small;font-family:Courier"> <p>As you know, Win 2008 and Vista make much use of junctions (aka reparse points). For example, &quot;Documents and Settings&quot; is a junction. When using a VBscript to enumerate all folders and files, the presence of the junction causes the subfolders and files to be listed twice. <br/><br/>Is there a way in VBscript to determine that a folder or file is really a junction? <br/><br/>I realize that I could start a subordinate CMD process to use the &quot;dir /al&quot; command, but was hoping for something more efficient, that avoids starting another process.<br/><br/>Thank you.<br/><br/>James Troy</p> </span></span>Tue, 24 Nov 2009 16:07:38 Z2009-11-24T21:01:51Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/148cc128-5440-427c-baee-9d8de9129494http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/148cc128-5440-427c-baee-9d8de9129494Mark1906http://social.technet.microsoft.com/Profile/en-US/?user=Mark1906Copying file numerous times and rename each file from Excel spread sheet (followed your answer to DF and didn't work)<p>Hi Scripting Guy,<br/><br/>I have a file that needs to be duplicated numerous times and named from a list in Excel spread sheet. I coded the following script from your response to DF:<br/><br/><br/>strComputer = &quot;.&quot;</p> <p>Set objWMIService = GetObject (&quot;winmgmts:\\&quot; &amp; strComputer &amp; &quot;\root\cimv2&quot;)</p> <p>Set colFiles = objWMIService.ExecQuery (&quot;Select * From CIM_DataFile Where Name ='C:\\Scripts\\Test.txt'&quot;)</p> <p>Set objExcel = CreateObject (&quot;Excel.Application&quot;)<br/>objExcel.Visible = True</p> <p>Set objWorkbook = objExcel.Workbooks.Open(&quot;C:\Documents and Settings\wilsonm1\My Documents\Projects\ENSRProjects\ENSRFileNames1.xls&quot;)</p> <p>intRow = 1</p> <p>Do Until objExcel.Cells (intRow, 1).Value = &quot;&quot;</p> <p> strNewName = objExcel.Cells (intRow, 1).Value</p> <p> For Each objFile in ColFiles<br/>  strCopy = &quot;C:\Scripts\&quot; &amp; strNewName<br/>  objFile.Copy(strCopy)<br/> Next</p> <p> intRow = intRow + 1<br/>Loop</p> <p>objExcel.Quit</p> <p>The script ran and I can't find the files. I thought they should be in C:\Scripts\new file?????</p>Mon, 23 Nov 2009 17:51:30 Z2009-11-24T16:55:15Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/dff6f402-79cd-48a7-a478-0394f429b4a9http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/dff6f402-79cd-48a7-a478-0394f429b4a9Thiago.Pereirahttp://social.technet.microsoft.com/Profile/en-US/?user=Thiago.PereiraGenerate a List of Last Modified files in a Folder and SubfoldersHello,<br/><br/>I'm trying to find an easy way to display files that have been modified since a relative date (12/31/2006) . I was recently looking at the FORFILES command which appears to allow this, but the help description is puzzling and I can't get it to work.<br/><br/>I need to generate a list of the files that were not modified in last 3 years, so last modified in December, 31, 2006 in a specific folder and subfolders, generate a log file with the all patch and file name and after that another line to push this log and delete all files.<br/><br/>Was thinking about (VBscript).<br/>Found this post: <a href="http://blogs.technet.com/heyscriptingguy/archive/2008/03/13/how-can-i-find-the-number-and-size-of-all-the-files-recently-modified-or-added-to-a-computer.aspx">http://blogs.technet.com/heyscriptingguy/archive/2008/03/13/how-can-i-find-the-number-and-size-of-all-the-files-recently-modified-or-added-to-a-computer.aspx</a> that could edit and help me, but I dont know how.<br/><br/>I was reading this Thread: <a href="http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/121ff244-b60b-4256-aadc-86286d274302">http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/121ff244-b60b-4256-aadc-86286d274302</a>, but question is pretty similar.<br/><br/>Hope you Guys can help.<br/><br/>Thanks in Advance.<br/> <hr class=sig> Thiago Pereira | http://thiagoinfrat.spaces.live.com | http://www.winsec.orgTue, 17 Nov 2009 00:12:49 Z2009-11-24T16:22:35Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/30e47c03-bc7c-47d1-bb6a-dea0f8a40612http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/30e47c03-bc7c-47d1-bb6a-dea0f8a40612Johnny Joehttp://social.technet.microsoft.com/Profile/en-US/?user=Johnny%20JoeVB script for lastlogon dnsserver.<p>I have a script for polling all the dns server in a domain to find the lastlogon, but the script I have doesn't store the name of the dns server that had the most current last logon.  Is that data stored in the user class somewhere.  Or do I need to take the most current time I found and verify it against evey dns server with a If most current time = last logon time on this dns server  echo the name?  I am not real sure how to go about verifying it either.  I got alot of this script from Richard Mueller's site <a href="http://www.rlmueller.net">http://www.rlmueller.net</a>  This script is great for auditing user accounts, so feel free to use it if you need it.  Thanks for your help in advance.<br/><br/>Johnny<br/><br/>Option Explicit <br/>Dim objRootDSE, strConfig, objConnection, objCommand, strQuery <br/>Dim objRecordSet, objDC <br/>Dim strDNSDomain, objShell, lngBiasKey, lngBias, k, arrstrDCs() <br/>Dim strDN, dtmDate, objDate, lngDate, objList, strUser<br/>Dim strBase, strFilter, strAttributes, lngHigh, lngLow</p> <p> </p> <p><br/>' Create dictionary to keep track of <br/>' users and login times <br/>Set objList = CreateObject(&quot;Scripting.Dictionary&quot;) <br/>objList.CompareMode = vbTextCompare <br/>' rmueller's script <br/>' Obtain local Time Zone bias from machine registry. <br/>Set objShell = CreateObject(&quot;Wscript.Shell&quot;) <br/>lngBiasKey = objShell.RegRead(&quot;HKLM\System\CurrentControlSet\Control\&quot; _ <br/>&amp; &quot;TimeZoneInformation\ActiveTimeBias&quot;) <br/>If UCase(TypeName(lngBiasKey)) = &quot;LONG&quot; Then <br/>lngBias = lngBiasKey <br/>ElseIf UCase(TypeName(lngBiasKey)) = &quot;VARIANT()&quot; Then <br/>lngBias = 0 <br/>For k = 0 To UBound(lngBiasKey) <br/>   lngBias = lngBias + (lngBiasKey(k) * 256^k) <br/>Next <br/>End If <br/>' Determine configuration context and DNS domain from RootDSE object. <br/>Set objRootDSE = GetObject(&quot;<a>LDAP://RootDSE</a>&quot;) <br/>strConfig = objRootDSE.Get(&quot;configurationNamingContext&quot;) <br/>strDNSDomain = objRootDSE.Get(&quot;defaultNamingContext&quot;) <br/>' Use ADO to search Active Directory for ObjectClass nTDSDSA. <br/>' This will identify all Domain Controllers. <br/>Set objCommand = CreateObject(&quot;ADODB.Command&quot;) <br/>Set objConnection = CreateObject(&quot;ADODB.Connection&quot;) <br/>objConnection.Provider = &quot;ADsDSOObject&quot; <br/>objConnection.Open &quot;Active Directory Provider&quot; <br/>objCommand.ActiveConnection = objConnection <br/>strBase = &quot;&lt;LDAP://&quot; &amp; strConfig &amp; &quot;&gt;&quot; <br/>strFilter = &quot;(objectClass=nTDSDSA)&quot; <br/>strAttributes = &quot;AdsPath&quot; <br/>strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot; <br/>objCommand.CommandText = strQuery <br/>objCommand.Properties(&quot;Page Size&quot;) = 100 <br/>objCommand.Properties(&quot;Timeout&quot;) = 60 <br/>objCommand.Properties(&quot;Cache Results&quot;) = False <br/>Set objRecordSet = objCommand.Execute <br/>' Enumerate parent objects of class nTDSDSA. Save Domain Controller <br/>' AdsPaths in dynamic array arrstrDCs. <br/>k = 0 <br/>Do Until objRecordSet.EOF <br/>Set objDC = _ <br/>   GetObject(GetObject(objRecordSet.Fields(&quot;AdsPath&quot;)).Parent) <br/>ReDim Preserve arrstrDCs(k) <br/>arrstrDCs(k) = objDC.DNSHostName <br/>k = k + 1 <br/>objRecordSet.MoveNext <br/>Loop <br/>' Retrieve lastLogon attribute for each user on each Domain Controller. <br/>For k = 0 To Ubound(arrstrDCs) <br/>strBase = &quot;&lt;LDAP://&quot; &amp; arrstrDCs(k) &amp; &quot;/&quot; &amp; strDNSDomain &amp; &quot;&gt;&quot; <br/>strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user))&quot; <br/> <br/>strAttributes = &quot;distinguishedName,lastLogon&quot; <br/>strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes _ <br/>   &amp; &quot;;subtree&quot; <br/>objCommand.CommandText = strQuery <br/>On Error Resume Next <br/>Set objRecordSet = objCommand.Execute <br/>If Err.Number &lt;&gt; 0 Then <br/>   On Error GoTo 0 <br/>   Wscript.Echo &quot;Domain Controller not available: &quot; &amp; arrstrDCs(k) <br/>Else <br/>   On Error GoTo 0 <br/>   Do Until objRecordSet.EOF <br/>      strDN = objRecordSet.Fields(&quot;distinguishedName&quot;) <br/>      lngDate = objRecordSet.Fields(&quot;lastLogon&quot;) <br/>     <br/>     On Error Resume Next <br/>     Set objDate = lngDate <br/>     If Err.Number &lt;&gt; 0 Then <br/>       On Error GoTo 0 <br/>       dtmDate = #1/1/1601# <br/>     Else <br/>       On Error GoTo 0 <br/>       'stored as a 64 bit integer that VBScript cannot handle, must <br/>       'seperate it to work with it. <br/>       lngHigh = objDate.HighPart <br/>       lngLow = objDate.LowPart <br/>       If lngLow &lt; 0 Then <br/>         lngHigh = lngHigh + 1 <br/>       End If <br/>       If (lngHigh = 0) And (lngLow = 0 ) Then <br/>         dtmDate = #1/1/1601# <br/>       Else <br/>         dtmDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _ <br/>           + lngLow)/600000000 - lngBias)/1440 <br/>       End If <br/>     End If <br/>     If objList.Exists(strDN) Then <br/>       If dtmDate &gt; objList(strDN) Then <br/>         objList(strDN) = dtmDate <br/>       End If <br/>     Else <br/>       objList.Add strDN, dtmDate <br/>     End If <br/>     objRecordSet.MoveNext <br/>   Loop <br/>End If <br/>Next <br/>Dim objNetwork,objExcel <br/>dim intRow <br/>intRow = 2 <br/>Set objNetwork = Wscript.CreateObject(&quot;Wscript.Network&quot;) <br/>Set objExcel = CreateObject(&quot;Excel.Application&quot;) <br/>objExcel.Visible = True <br/>objExcel.Workbooks.Add</p> <p>objExcel.Cells(1,1).value = &quot;First Name&quot;<br/>objExcel.Cells(1,2).value = &quot;Last Name&quot;<br/>objExcel.Cells(1,3).value = &quot;User ID&quot; <br/>objExcel.Cells(1,4).value = &quot;Last Logon Date&quot; <br/>objExcel.Cells(1,5).value = &quot;Last Logon Time&quot;<br/>objExcel.Cells(1,6).value = &quot;Last Logon Server&quot;<br/>objExcel.Cells(1,7).value = &quot;Account Status&quot;</p> <p>' Output latest lastLogon date for each user. <br/>Dim easydate1 <br/>Dim easydate2<br/>Dim objUser</p> <p>For Each strUser In objList <br/>'easydate1 is the date stamp<br/>'easydate2 is the time stamp<br/>easydate1 = objList(strUser) <br/>easydate1 = FormatDateTime(easydate1,2)<br/>easydate2 = objList(strUser) <br/>easydate2 = FormatDateTime(easydate2,3)<br/>'output username and last login date and last login time<br/>' change 1/1/1601 to Never for Never logged in <br/>If easydate1 = &quot;1/1/1601&quot; Then <br/> easydate1 = &quot;Never&quot; <br/>End If  <br/>' change 12:00:00 AM to Never for Never logged in<br/>If easydate2 = &quot;12:00:00 AM&quot; Then<br/> easydate2 = &quot;Never&quot;<br/>End If</p> <p>Set objUser = GetObject _<br/>    (&quot;LDAP://&quot; &amp; struser &amp; &quot;&quot;)</p> <p>objExcel.Cells(intRow,1).value = objuser.givenname<br/>objExcel.Cells(intRow,2).value = objuser.sn<br/>objExcel.Cells(intRow,3).value = objuser.sAMAccountName <br/>objExcel.Cells(intRow,4).value = easydate1 <br/>objExcel.Cells(intRow,5).value = easydate2</p> <p><br/>'*Problem area Start*<br/>'objExcel.Cells(intRow,6).value = lastlogon dns server name<br/>'populated disabled column <br/>'*Problem area End*</p> <p><br/>if objuser.AccountDisabled = True Then <br/> objExcel.Cells(intRow,7).value = &quot;DISABLED&quot;<br/>Else<br/> objExcel.Cells(intRow,7).value = &quot;ACTIVE&quot;<br/>End if <br/>intRow = intRow + 1</p> <p>Next</p> <p>'sort by login Date <br/>Dim obrange, obrange2 <br/>Set obrange = objExcel.Range(&quot;A:K&quot;) <br/>Set obrange2 = objExcel.Range(&quot;A2&quot;) <br/>obrange.Sort obrange2,1,,,,,,1</p> <p><br/>' Clean up. <br/>objConnection.Close <br/>Set objRootDSE = Nothing <br/>Set objConnection = Nothing <br/>Set objCommand = Nothing <br/>Set objRecordSet = Nothing <br/>Set objDC = Nothing <br/>Set objDate = Nothing <br/>Set objList = Nothing <br/>Set objShell = Nothing <br/>Set obrange = Nothing <br/>Set obrange2 = Nothing <br/>Set objExcel = Nothing <br/>WScript.Quit</p><hr class="sig">JohnnyTue, 30 Jun 2009 18:51:28 Z2009-11-24T16:04:14Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/4de309bc-d97f-4c96-86c7-2cc85f093c8ehttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/4de309bc-d97f-4c96-86c7-2cc85f093c8ecesaremsdnhttp://social.technet.microsoft.com/Profile/en-US/?user=cesaremsdnreset local admin password on windows server 2008Hello,<br/><br/>there is a script that i can use with gpo on windows server 2008 that actually reset /remove the local admin built in password for all clients/users? <br/><br/>ThanksTue, 24 Nov 2009 15:21:10 Z2009-11-24T15:57:49Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/514740df-2770-4885-b30b-f7ea977a639ahttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/514740df-2770-4885-b30b-f7ea977a639agroovyfhttp://social.technet.microsoft.com/Profile/en-US/?user=groovyfPermission denied copying file to Progam Files folderWe use SAP in our business which is installed in the Program Files (or Program Files (x86) if using 64bit OS) folder, and have a .ini file in the SAPGui folder located within Program Files which lists all connections available when the user starts the program.<br/> This is updated from time-to-time, and is copied across from a central network location as part of the login script. We've had no issues with Windows XP at all, however, now we're testing Windows 7, I'm finding I'm getting a Permission Denied error when it's trying to copy the file locally (thanks to UAC, I guess)<br/> I *thought* there was some &quot;virtual&quot; folder that was referenced for just such occassions - where a seperate folder was created outside of Program Files but with the same structure... is this not the case?<br/> Is there any workaround for me?<br/> <br/> Thanks<br/> CraigMon, 23 Nov 2009 15:05:31 Z2009-11-24T14:31:59Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/a3fedbc9-4046-4db9-a24c-99372e5a0805http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/a3fedbc9-4046-4db9-a24c-99372e5a0805sonihmhttp://social.technet.microsoft.com/Profile/en-US/?user=sonihmWMI Asynchronously in ASP.NET<p>Hi,<br/><br/>I am developing ASp.net app  using WMI.  I have one button and textbox in web form.<br/>When user click  button, I want to execute below program code under button click<br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">protected</span></span><span style="font-size:x-small"> </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">void</span></span><span style="font-size:x-small"> Button1_Click(</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">object</span></span><span style="font-size:x-small"> sender, </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">EventArgs</span></span><span style="font-size:x-small"> e) <p>{ }</p> <font size=2> <p> </p> </font></span></p> <p><br/><br/>I WANT TO EXECUTE BELOW CODE WHEN BUTTON CLICK OCCUR, How can I do it?<br/><br/>using System;<br/>using System.Management;<br/>using System.Windows.Forms;</p> <p>namespace WMISample<br/>{<br/>    public class WMIReceiveEvent<br/>    {<br/>        public WMIReceiveEvent()<br/>        {<br/>            try<br/>            {<br/>                WqlEventQuery query = new WqlEventQuery(<br/>                    &quot;SELECT * FROM Win32_ProcessStartTrace WHERE ProcessName = 'notepad.exe'&quot;);</p> <p>                ManagementEventWatcher watcher = new ManagementEventWatcher(query);<br/>                Console.WriteLine(&quot;Waiting for an event...&quot;);</p> <p>                watcher.EventArrived += <br/>                    new EventArrivedEventHandler(<br/>                    HandleEvent);</p> <p>                // Start listening for events<br/>                watcher.Start();</p> <p>                // Do something while waiting for events<br/>                System.Threading.Thread.Sleep(10000);</p> <p>                // Stop listening for events<br/>                watcher.Stop();<br/>                return;<br/>            }<br/>            catch(ManagementException err)<br/>            {<br/>                MessageBox.Show(&quot;An error occurred while trying to receive an event: &quot; + err.Message);<br/>            }<br/>        }<br/>        <br/>        private void HandleEvent(object sender,<br/>            EventArrivedEventArgs e)<br/>        {<br/>            Console.WriteLine(&quot;Win32_ProcessStartTrace event occurred.&quot;);<br/>        }</p> <p>        public static void Main()<br/>        {<br/>            WMIReceiveEvent receiveEvent = new WMIReceiveEvent();<br/>            return;<br/>        }</p> <p>    }<br/>}</p>Wed, 18 Nov 2009 04:07:31 Z2009-11-24T13:18:13Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/5ee26769-4f14-4dba-b652-c75885586b59http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/5ee26769-4f14-4dba-b652-c75885586b59K R Nhttp://social.technet.microsoft.com/Profile/en-US/?user=K%20R%20NAutomate in task scheduler to runa c# script , whena new file is created in the folder ?I do have a C# script which i need to run automatically whenever a file is created in the folder.<br/>I searched in task scheduler for the above , i did not find any visible solution . Can anyone help me with this ???? Any help is appreciated.<br/><br/>Is there any other way , can anybody guide with this ?<br/><br/>ThanksThu, 12 Nov 2009 06:58:25 Z2009-11-24T13:15:58Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/8079383c-d01b-44a3-8e97-72ee36776fe3http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/8079383c-d01b-44a3-8e97-72ee36776fe3arectechhttp://social.technet.microsoft.com/Profile/en-US/?user=arectechPowershell directory splitterHi,<br/> Our call center makes recordings which are converted to mp3 files and put into a directory with a name of month like this... 2009-01-30. When I get time, I archive them to dvd/dvd-dl .<br/> This time of year, the folders can get quite large and it's a pain to divide them up to fit on dvds.<br/> I made a little diddy to split the folders but I'm looking to see if someone has a better way of doing this or improving the code.<br/> <br/> <br/> # Copy files into DVD or DVD-DL size folders<br/> # With flex room for larger files<br/> <br/> Function CopyFiles{<br/> <br/> # Get source path for the copy operation.<br/> param ($SourceFolder = $(Read-Host &quot;Please Enter The Source Path&quot;))<br/> <br/> $intFiles = 53000<br/> # intFiles = 29000<br/> <br/> If (!(Test-Path -path &quot;$SourceFolder&quot;)) {<br/>    Exit<br/> }<br/> <br/> $Num = 1<br/> $Counter = 0<br/> $TargetFolder = $SourceFolder + &quot;-&quot; + $Num<br/>     New-Item &quot;$TargetFolder&quot; -Type Directory<br/> <br/>   Foreach ($File in (gci $SourceFolder -Recurse)){<br/>     If ($Counter -eq $intFiles){<br/>       $Num = $Num + 1<br/>       $Counter = 0<br/>       $TargetFolder = $SourceFolder + &quot;-&quot; + $Num<br/>       New-Item &quot;$TargetFolder&quot; -Type Directory<br/>     }<br/>     Copy-Item $SourceFolder\$File $TargetFolder<br/>     $Counter = $Counter + 1<br/> <br/>   } <br/> }<br/> CopyFiles<br/> <br/> <br/> thanks,<br/> rcTue, 24 Nov 2009 12:48:10 Z2009-11-24T12:48:14Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7718eecc-c272-436e-b1fb-6e50c9329b11http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7718eecc-c272-436e-b1fb-6e50c9329b11B. Voroshttp://social.technet.microsoft.com/Profile/en-US/?user=B.%20VorosHow to export a DictionaryBase Propertycollection object to csv using PowerShell.Hi,<br/> <br/> I am trying to export an Active Directory user's details into a csv file.<br/> Got as far as having the user's details in a System.Collections.DictionaryBase ResultPropertyCollection object.<br/> <br/> I would like to export this to a csv so thet the Keys are the header and the Values are the values.<br/> <br/> More generally, I want to export a collection/hashtable so that the keys/index are the header and the values are the values.<br/> <br/> Struggling to achieve this.<br/> <br/>Sat, 21 Nov 2009 14:08:47 Z2009-11-24T08:52:49Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c5758e58-b94d-4939-93af-e61ce1a443a6http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c5758e58-b94d-4939-93af-e61ce1a443a6Bojinovhttp://social.technet.microsoft.com/Profile/en-US/?user=BojinovPowerShell v1 will crash on raising event<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> <p>Hi guys and gals,</p> <span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> <p>I ve encountered a problem with Powershell v1 and am interested if any of you can induce it.</p> <p>[code]</p> <span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"> <p>function</p> </span></span></span></span></span></span> <p><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">watch</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> { </span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$args</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">[0] </span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">if</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> (</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">-eq</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$null</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">){</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">$((</span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">gi</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> .).Fullname)} </span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">if</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> (</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">-eq</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">&quot;.&quot;</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">){</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">$((</span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">gi</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> .).Fullname)} </span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">if</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> ([</span></span><span style="font-family:Courier New;color:#008080;font-size:x-small"><span style="font-family:Courier New;color:#008080;font-size:x-small"><span style="font-family:Courier New;color:#008080;font-size:x-small">system.io.directory</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">]::</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">exists</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">(</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">)) {  <span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">new-object</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">System.IO.FileSystemWatcher</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$dir</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.IncludeSubDirectories </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$false</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></p> <p><span style="font-family:Courier New;color:#008000;font-size:x-small"><span style="font-family:Courier New;color:#008000;font-size:x-small"><span style="font-family:Courier New;color:#008000;font-size:x-small">#$fsw.SynchronizingObject = </span></span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.add_Changed({</span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">Write-Host</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><em><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">-f</span></span></span></em><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">Red</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">&quot;$((get-date).ToShortTimeString()) : $($_.FullPath)$($_.ChangeType)&quot;</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">}) </span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.EnableRaisingEvents </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$true</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">;<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">while</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">(</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$true</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">){<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">if</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> (</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$host</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">ui</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">rawui</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">KeyAvailable</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">){<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">If</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> ((</span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$host</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">ui</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">rawui</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.</span></span><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small"><span style="font-family:Courier New;color:#8b4513;font-size:x-small">ReadKey</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">()).VirtualKeyCode </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">-eq</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">&quot;88&quot;</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">) { # ctrl + x<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span></p> <p><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">write-host</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">&quot;Stopping watcher...&quot;</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">; </span></span></p> <p><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.EnableRaisingEvents </span></span><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small">=</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$False</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">; </span></span></p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">break</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">; </span></span></p> <p>}}}}</p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">else</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> {</span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">&quot;Directory $dir does not exist&quot;</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">} } </span></span></p> <p>[/code]</p> <span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> <p>This snippet is supposed to monitor changes is a selected folder. I ve found it some place (</p> <p><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">do</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> not remember </span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">where</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">but</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">thanks</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">to</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">the</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">one</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">who</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">made</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">it</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">)<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> Problem is that the </span></span></span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">PS</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">will</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">crash</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">on</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">raising</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">an</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> event. </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">I</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">can</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">easily</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">induce</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">it</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">on</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">XP</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">and</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> Vista. </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">Just</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">start</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">the</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> script, </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">say</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">that</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">you</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">will</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">watch</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">the</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">c:\something</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">folder</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">and</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">create</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">a</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">text</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">file</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">in</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> it, </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">containing</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">few</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> symbols. </span></span></p> <p>What I ve tried:<br/><br/>uninstalled the community ext pack PSCX-1.2</p> <span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"> <p><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">install the PSeventing from codeplex (PSEventing 1.1) and use it<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">uninstall the community pack (PSCX-1.2)</span></span> <span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"><span style="font-family:Courier New;color:#ff0000;font-size:x-small"></span></span></span></span></p> <p>Does not matter what I <span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">try</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> every time I call </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.add_Changed or </span></span><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small"><span style="font-family:Courier New;color:#800080;font-size:x-small">$fsw</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">.add_Created, the </span></span><strong><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small"><span style="font-family:Courier New;color:#5f9ea0;font-size:x-small">PS</span></span></span></strong><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small"><span style="font-family:Courier New;color:#800000;font-size:x-small">will</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> crash.<span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> </span></span></span></span> </p> <p>Could you please <span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">try</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> it and let me know it </span></span><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">if</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> works </span></span><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small"><span style="font-family:Courier New;color:#0000ff;font-size:x-small">for</span></span></span><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small"> you ? </span></span></p> <p>Thanks</p> <p>Momchil Bojinov</p> </span></span></span></span></span></span></span></span></span></span></span></span>Tue, 24 Nov 2009 08:38:36 Z2009-11-24T08:44:05Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/3ed90e05-eff9-440b-9abb-e321b0ab19bbhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/3ed90e05-eff9-440b-9abb-e321b0ab19bbAmjad Shaikhttp://social.technet.microsoft.com/Profile/en-US/?user=Amjad%20ShaikHow to Find local Admin Users for Entire Domain ...( Windows 2003 R2 )Hello Friends,<br/> <br/> We have found some of the domain users are having local admin rights on their PCs.<br/> <br/> We need to find out the users those who are member of Administrator Account &amp; remove them from Domain.<br/> <br/> Is there any tool / Script to find out...???<br/> <br/> Our Domain is Windows 2003 Enterprize R2.<br/> <br/> Kindly help me ..Thanks in Advanced.<hr class="sig">Regards, AmjadMon, 23 Nov 2009 08:54:48 Z2009-11-24T07:51:19Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/103a0f65-fb96-4c5d-81e8-cd42406e4b39http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/103a0f65-fb96-4c5d-81e8-cd42406e4b39cehottlehttp://social.technet.microsoft.com/Profile/en-US/?user=cehottleWMI Query Returns Incorrect TimeGenerated ValueIn March, I wrote &quot;<span style="font-size:11pt;font-family:'Calibri','sans-serif'">The TimeGenerated value returned by a VBScript using the query, SELECT * FROM Win32_NTLogEvent, with a date filter began returning the wrong date after the DST change this past weekend.<span style="">  </span>It is now one hour behind.<span style="">  </span>The script queries the event logs on our production SQL Servers from a central monitoring server.<span style="">  </span>As a result, I had to employ a work-around to have my script work correctly.<span style="">  </span>Has anyone in your group encountered this issue and, if so, how do you fix it?<span style=""> &quot;<br/><br/>Ed Wilson wrote back that it was a bug and there would be a fix released.  In October, Ed pointed me to <span style="font-size:11pt;font-family:'Calibri','sans-serif'">KB 970413 as the fix.  <br/><br/> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:x-small;font-family:Arial">We applied the hotfix to all of the database servers that I monitor using a centralized WMI query utility.<span style="">  </span>Unfortunately, the patch does not seem to have resolved the issue.<span style="">  </span>We are seeing the same behavior that we saw in the spring.<span style="">  </span>For example, there is an error entry in the Event Log on one server this morning from 5:43 AM.<span style="">  </span>The WMI query that was run on our monitoring server returned 6:43 AM.<span style="">  </span>Since our utility uses the last poll date/time in the filter for the query, the result of this is that the entry is returned every time the utility is run until an hour has passed (from 5:43 to 6:44).<span style="">  </span>Do you know if there have been other reports of this patch not resolving the issue?<span style="">  </span>Thanks.<br/><br/> <p class=MsoPlainText style="margin:0in 0in 0pt">Chuck Hottle</p> <p class=MsoPlainText style="margin:0in 0in 0pt">Tillamook County Creamery Association</p> <p class=MsoPlainText style="margin:0in 0in 0pt">6855 SW Baylor Street</p> <p class=MsoPlainText style="margin:0in 0in 0pt">Tigard, OR 97223</p> <p class=MsoPlainText style="margin:0in 0in 0pt">503-619-4242 phone</p> <font face=Arial size=2> <p class=MsoPlainText style="margin:0in 0in 0pt"> </p> </font></span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"> </p> </span></span></span>Thu, 19 Nov 2009 21:35:53 Z2009-11-23T22:31:41Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d89913a1-c1bf-49b0-b76f-703740fb5abahttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d89913a1-c1bf-49b0-b76f-703740fb5abaJoe Moylehttp://social.technet.microsoft.com/Profile/en-US/?user=Joe%20MoyleAdd or Move Excel sheet with PowerShellI've had good success with working with Excel and PowerShell except I fail to find how to add or move a sheet to the last position.  It appears to me that the Add and Move methods accept similar arguments so I'm just going to focus on attempting to get it to work with the optional After argument.  Here is what I have.<br/><br/>#get my sheets<br/> $Sheets = $WorkBook.WorkSheets<br/>#find the index of the last one<br/> $SheetCount = $Sheets.Count<br/>#create an object reference to the last sheet<br/> $LastSheet = $WorkBook.Sheets | WHERE {$_.Index -eq $SheetCount}<br/>#attempt to create the new sheet after the last one<br/> $NewSheet = $Sheets.Add($LastSheet After)<br/><br/>It does not work.  Do any of you know how to create a sheet in the last position with PowerShell?<hr class="sig">Joe MoyleMon, 23 Nov 2009 03:54:34 Z2009-11-23T21:36:01Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d11d5592-7b19-4e46-8ad7-972c3cb49f06http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d11d5592-7b19-4e46-8ad7-972c3cb49f06.Tim Harrisonhttp://social.technet.microsoft.com/Profile/en-US/?user=.Tim%20HarrisonWireless Configuration ScriptI have been tasked with creating a report that lists the computers in our SCCM 2007 system that currently have wireless SSID's configured and what security they are configured to use (none, WEP, WPA, etc.).  I don't see that as a default report in SCCM, so I was thinking of creating some kind of script that I would deploy to the machines that would write this information to a text file that I could then gather in some way.<br/> <br/> Is there any kind of WMI (or other) script that will list all configured SSIDs and what type of security they're configured to use?<br/> <br/> I was looking at this tool: http://www.symantec.com/connect/articles/how-capture-and-deploy-wlan-profiles<br/> <br/> ... which in 3 seperate commands will find the GUID of the WLAN card, find the SSIDs and find the type of encrypton, keys, etc., but each successive command uses output from the one before it, so I'm not sure how to script it.<br/> <br/> ThanksWed, 18 Nov 2009 21:03:37 Z2009-11-23T20:16:16Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/78c70570-6195-4dde-bcf9-91ef9a107905http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/78c70570-6195-4dde-bcf9-91ef9a107905Leo Clouserhttp://social.technet.microsoft.com/Profile/en-US/?user=Leo%20ClouserVBScript routine to move / hide an IE window on the desktopI have a pop up box that I do not want a user to fill in. I would like to move this window off the desktop, then I will proxy in credentials using VBScript. If I could hide this window - but still be able to access it using VBScript - that would be perfect. Any help would be appreciated.<br/> <br/> Thanks!<br/> <br/> LeoThu, 23 Jul 2009 13:46:12 Z2009-11-23T18:51:19Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7d3f00ec-8270-49e4-aeff-42d07e1d6919http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7d3f00ec-8270-49e4-aeff-42d07e1d6919Richard Davies FDChttp://social.technet.microsoft.com/Profile/en-US/?user=Richard%20Davies%20FDCUsing CSVDE export/import a global security groupingHi, new to AD first time using CSVDE,<br/> 2008 domain<br/> <br/> In the domain, created a global security group of 128 users to be applied to some app based policys.<br/> need to export the group to a csv file, to transfer to a test domain which mirrors live, which i think i can export with<br/> CSVDE -d &quot;cn=g-sec-appgrouping,OU=dept,OU=london,DC=blah,dc=com&quot; -f appgroup.csv<br/> Test system is a direct mirror of live.<br/> I now need to import it in to live <br/> Question would the global security be a CN class or an OU class<br/> and would the Import string look like this<br/> CSVDE -i &quot;cn=g-sec-appgrouping,OU=dept,OU=london,DC=blah,dc=com&quot; -f appgroup.csv<br/> Trying to do this in theory at home, to get my head round it,before i get to work to try it out tomorrow.<br/> any advice gratefully welcomed<br/> <br/> <br/>Thu, 19 Nov 2009 21:04:52 Z2009-11-23T18:05:21Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c35e7c1e-d5c1-421c-999a-7affeacd1668http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c35e7c1e-d5c1-421c-999a-7affeacd1668sdduhttp://social.technet.microsoft.com/Profile/en-US/?user=sdduPassword expiration e-mail Hello,<br/> <br/> i would like my users to be notified bij e-mail (exchange 2007) when there password is about to expire. Does someone have a script i can use for that ?<br/> <br/> thanks DaveTue, 21 Apr 2009 08:34:47 Z2009-11-23T17:42:25Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/29aed92c-24f3-48c6-be77-649aacca8921http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/29aed92c-24f3-48c6-be77-649aacca8921Renjith-IT Specialisthttp://social.technet.microsoft.com/Profile/en-US/?user=Renjith-IT%20SpecialistWondows 7 System image backup automationIs it possible to automate windows system image backup remotely (i mean through Group policy or scripts).? if yes please give some solutions <br/><br/>We have so many client machines in our office ..we need to take atleast one copy of all machines system image very efficently <br/><br/><br/>Thanks<br/>RenjithMon, 23 Nov 2009 07:28:44 Z2009-11-23T07:28:44Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/6e4d1bdb-40bc-4da8-96c3-5caf1afa5d92http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/6e4d1bdb-40bc-4da8-96c3-5caf1afa5d92mythrandir52http://social.technet.microsoft.com/Profile/en-US/?user=mythrandir52Win32_share and Print Queue creationDoes anyone have a sample of a script using win32_share to create Print Queues?  I have in the process of rewriting all of the script that manage my print enviroment from vbscript to power shell.  Currently I and calling the dll method to create the queue and I want to try new method that will have actual return code that can be evaluated.Mon, 23 Nov 2009 05:33:14 Z2009-11-23T05:33:15Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/6564a288-1725-4480-8af5-1fb3840519c5http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/6564a288-1725-4480-8af5-1fb3840519c5Sainath IRP_MJ_CREATEhttp://social.technet.microsoft.com/Profile/en-US/?user=Sainath%20IRP_MJ_CREATEQuery Network Interface Counters<p>Hi All,<br/><br/>i want to query network interface counters for checking network speed ( bytes out and bytes in ) , i am familiar in writing it down in c++ but i need a script to attach it to our custom app. Please provide me a sample script which can query network interface counters ( one defined in perfmon counters ) <br/><br/>If you any one has a sample script using please do help me <br/></p>Wed, 18 Nov 2009 15:01:11 Z2009-11-22T20:35:36Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7a1278bd-b271-41b8-8198-96485ae4d75fhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7a1278bd-b271-41b8-8198-96485ae4d75fNilavehttp://social.technet.microsoft.com/Profile/en-US/?user=NilaveMicrosoft Management console tipsHi guys,<br/> Im trying to create a simple taskpad view in MMC to ping (eg ping www.google.com)<br/> Now i select shell command and select the command from C:\windows\system32\ping.exe<br/> Now my question is how to add the variable like <a href="http://www.google.com/">www.google.com</a> or <a href="http://www.orkut.co.in/">www.orkut.com</a> to this command. When i click on the parameter arrow,it shows :Target Node Name $name&lt;0&gt;, target node parent name $name&lt;1&gt; and name $col&lt;0&gt;<br/> Im unable to understand what is $col&lt;0&gt;,$name&lt;0&gt; and &lt;1&gt;<br/> Can anyone please clear me out on this.Can we pass variables using Taskpad shell commands?<br/> Also if you can suggest any books for mmc that will be highly appreciatedSun, 22 Nov 2009 19:45:57 Z2009-11-22T19:45:58Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b44aa748-4fd5-40a7-9e20-40e853756908http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/b44aa748-4fd5-40a7-9e20-40e853756908saurabh180407http://social.technet.microsoft.com/Profile/en-US/?user=saurabh180407Newbie : Syntax Problem in Powershell<span style="font-size:12px;line-height:16px"># setting the folder location <br/>$loc = 'e:\dsain\dc prd' <br/><br/># i want to use dos command from power shell to list the  contents of above dir </span> <div><span style="font-size:12px;line-height:16px"># i am using following command <br/><br/>invoke-expression &quot;cd $loc : dir&quot; <br/><br/>i get an error <br/>Set-Location : A parameter cannot be found that matches parameter name 'prd'. <br/>At line:1 char:3 <br/>+ cd &lt;&lt;&lt;&lt; e:\saurabh\eain preid dir <br/><br/>--it works fine if there is no space in folder name i.e <br/>if <br/>$loc = 'e:\dsain\dcprd'</span></div><hr class="sig">studentFri, 20 Nov 2009 20:58:16 Z2009-11-22T07:34:17Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/5aa7c924-81be-49b2-a62d-a4544467afaehttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/5aa7c924-81be-49b2-a62d-a4544467afaeSzucsShttp://social.technet.microsoft.com/Profile/en-US/?user=SzucsSHow to invoke Outlook 2007 macro from Powershell?How to invoke an existing Outlook 2007 macro from Powershell?Sat, 21 Nov 2009 23:52:18 Z2009-11-21T23:52:19Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9d558bbd-8cad-491c-84a8-c9082cee8e5chttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9d558bbd-8cad-491c-84a8-c9082cee8e5cRaffiMesdjianhttp://social.technet.microsoft.com/Profile/en-US/?user=RaffiMesdjianConvert Date/Time to LastLogon or LastLogonTimeStamp for ADInstead of converting from LastlogonTimeStamp to datetime I would like to go the other way converting from a datetime format to LastLogon or LastLogonTimeStamp format.<br/> <br/> Thanks,<br/> <br/> RaffiWed, 18 Nov 2009 15:51:16 Z2009-11-21T22:26:35Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/dc034aae-9395-4894-bec2-a901b09e9527http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/dc034aae-9395-4894-bec2-a901b09e9527AndreThompsonhttp://social.technet.microsoft.com/Profile/en-US/?user=AndreThompsonHow do I implement the VBScript MailEnable method in Powershell?Hi<br/><br/>I have the following VBScript code which creates a distribution group and mail enables it into an Exchange 2003 distribution list:<br/><br/>strGroupName = &quot;testgroup&quot;<br/> Set objOU = GetObject(&quot;<a>LDAP://OU=MyOU,DC=mydomain,DC=</a>com&quot;)<br/>  ' create group<br/>  Const ADS_GROUP_TYPE_GLOBAL_GROUP = &amp;H2<br/>  Set oGroup = objOU.Create(&quot;Group&quot;, &quot;cn=&quot; &amp; strGroupName)<br/>  oGroup.Put &quot;groupType&quot;, ADS_GROUP_TYPE_GLOBAL_GROUP<br/>  oGroup.MailEnable<br/>  oGroup.SetInfo<br/><br/>The code is run from a Windows 2003 Domain Controller without any Exchange tools/utilities installed and this works.<br/><br/>I now want to convert this to PowerShell so I have come up with the following:<br/><br/>Set-Variable -Name ADS_GROUP_TYPE_GLOBAL_GROUP      -value 2       -option constant<br/>$Type = $ADS_GROUP_TYPE_GLOBAL_GROUP<br/>$GroupName = &quot;testgroup&quot;<br/>$objOU = [ADSI]&quot;<a>LDAP://OU=MyOU,DC=mydomain,DC=</a>com&quot;<br/>$objGroup = $objOU.Create(&quot;group&quot;, &quot;CN=&quot; + $GroupName)<br/>$objGroup.put(&quot;grouptype&quot;, $Type)<br/>$objGroup.MailEnable()<br/>$objGroup.SetInfo()<br/><br/>The code successfully created the group, however the group was not Mail Enabled despite that there were no error messages.<br/><br/>Can someone tell me what I need to do to get the same functionality in PowerShell?<br/><br/>Thanks.<br/><br/>- Andre<br/><br/>Fri, 20 Nov 2009 15:55:10 Z2009-11-21T22:00:39Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/3e4a64c0-3806-4b35-8861-671bcd3841f1http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/3e4a64c0-3806-4b35-8861-671bcd3841f1sjfmywayhttp://social.technet.microsoft.com/Profile/en-US/?user=sjfmywayInternet explorer 8 - search provider default message every time explorer 8 is openedI upgraded to internet explorer 8, every time I access explorer 8, now, I receive a message that search provider default is set to live search.  I removed all other search providers, I still get this message each time explorer 8 is accessed, I always have live search as my default but this error message still pops up, than redirects me to the search provider utility, every time.  I even check the box requesting not to change or corrupt the search provider.  Running windows XP.Sat, 21 Nov 2009 04:47:41 Z2009-11-21T15:48:41Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9a660b5c-bc41-4ea2-a086-c0b0d7df01f9http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/9a660b5c-bc41-4ea2-a086-c0b0d7df01f9Nathan Vileynhttp://social.technet.microsoft.com/Profile/en-US/?user=Nathan%20VileynChange desktop color using VBSCRIPTHi, <br/> has anyone a vbscript to change the desktop color for some users in an OU? And another color for specific users?<br/> thanks!<br/> NathanSat, 21 Nov 2009 10:02:30 Z2009-11-21T10:02:31Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/a028482c-bfdf-47a0-a7e0-dbc506890e34http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/a028482c-bfdf-47a0-a7e0-dbc506890e34cwattshttp://social.technet.microsoft.com/Profile/en-US/?user=cwattsUsing Powershell to delimit firewall ACLs <p>I am a relative newbie to Powershell, but really love it.  I am new enough where, when presented with a somewhat complex problem, I just frustratingly flail arround.  I have a couple of projects where I can use knowledge gained from this thread, but the immediate one involves parsing out some Cisco firewall ACLs.  Once I get them parsed, I can do anything with them...use ft to make them more digestible within PS, import directly into a DB or Excel.  <br/><br/>But I cannot quite figure out how to get there.  The way I have been trying to attack it is to think how I can get everything between, for example, spaces 3 and 5 in a string after a particular substring occurs.  Might be barking up the wrong tree.  Is there any way that I can delimit substrings with powershell?  My application is to delimit Cisco ACL strings in order to further process them, export them, etc. Here are some example entries:</p> <p>access-list inside_access_in extended  permit  tcp  object-group SiteLocal-Network  object-group Server-DataCenter-IntranetServers  Object-group Sharepoint<br/>access-list inside_access_in extended  permit  udp  object-group SiteLocal-Network  object-group Server-DataCenter-DomainControllers  eq domain<br/>access-list inside_access_in extended  permit  tcp  object-group SiteLocal-MSSMSServer  object-group Server-w2k3s-DataCenter-08  eq 445<br/>access-list inside_access_in extended  permit  tcp  object-group SiteLocal-DomainControllers  object-group Server-DataCenter-SQL  range 1024 65535<br/>access-list SalesOffice_DataCenter_vpn extended  permit  ip  10.1.1.0 255.255.252.0  10.2.2.0 255.255.252.0 <br/>access-list inside_access_in extended  deny  ip  any  any <br/>access-list outside_access_in  remark Allow ping to work</p> <p><br/>Here is a format I would like and the way I have been trying to attack it:</p> <p>ACL | Permit_Rem | Prot | Source | Dest | Eq</p> <p>ACL = everything prior to permit/deny/remark<br/>Permit_Rem = permit/deny/remark (if value != &quot;permit&quot; or &quot;deny,&quot; assume &quot;remark&quot; insert 4x &quot;|&quot; delimiters then process Eq field) <br/>Prot = tcp/udp/ip<br/>Source = everything 1-3 spaces from tcp/udp/ip<br/>Dest = everything 3-5 spaces from tcp/udp/ip<br/>Eq = everything from 5th space to end</p> <p><br/>Here are some manually delimited entries:<br/>access-list inside_access_in extended | permit | tcp | object-group SiteLocal-Network | object-group Server-DataCenter-IntranetServers | Object-group Sharepoint<br/>access-list inside_access_in extended | permit | udp | object-group SiteLocal-Network | object-group Server-DataCenter-DomainControllers | eq domain<br/>access-list inside_access_in extended | permit | tcp | object-group SiteLocal-MSSMSServer | object-group Server-w2k3s-DataCenter-08 | eq 445<br/>access-list inside_access_in extended | permit | tcp | object-group SiteLocal-DomainControllers | object-group Server-DataCenter-SQL | range 1024 65535<br/>access-list SalesOffice_DataCenter_vpn extended | permit | ip | 10.1.1.0 255.255.252.0 | 10.2.2.0 255.255.252.0 | <br/>access-list inside_access_in extended | deny | ip | any | any |  <br/>access-list outside_access_in | remark | | | | Allow ping to work</p> <p>Notes:<br/>1) The above combines &quot;Permit&quot; and &quot;Remark&quot; fields into &quot;Permit_Rem&quot; field.  Posisble values are Permit, Deny, and &quot;Remark<br/>2) Possible values for Prot (Protocol) are TCP, UDP, and IP<br/>3) Source and Dest fields both can use &quot;object group + name&quot; OR &quot;network + subnet&quot; notation<br/>4) Eq field can use remark text, &quot;object group + name&quot;, &quot; eq + name or port number&quot;, or &quot; range + two port numbers&quot; as value</p> <p>Thanks very much for your help.</p>Sat, 21 Nov 2009 00:38:08 Z2009-11-21T03:42:00Z