Login | |
|
 |
RE: Terminal Server Maintenance - 2/21/2006 2:46:32 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
I am the TS server administrator at my job as well, I am curious why you developed an in house solution (hiveenum.exe) when there was a MS KB fix for the same thing? Also, I have yet to run into this problem with the user specific hive not unloading, what happens to the server when this happens and how do you fix it? (other than your script) Would you please send me your libraries and that console app to the email account listed on my forum account? Thanks!
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Terminal Server Maintenance - 2/21/2006 2:51:59 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
I have a few comments. 1) I think some more indentation would make the code more legible. 2) It is well commented. 3) It appears to be using some library functions which you have not posted. That makes this code very hard to be adapted to someone else's environment.(Disregard) 4) It looks like you use several arrays to keep track of the folders to search and information on how to process those folders. I would lean toward a dictionary to do this. 5) Do While True Loop constructs are dangerous IMO and run the risk of wasting resources. 6) I think the use of a global On Error Resume Next statement is dangerous in that it would mask errors that you really should correct. As always, these comments are purely my opinion and since you have a script that does what you need, then by definition it is written correctly.
< Message edited by ebgreen -- 2/21/2006 3:40:15 AM >
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Terminal Server Maintenance - 2/21/2006 3:36:26 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
quote:
ORIGINAL: ebgreen 3) It appears to be using some library functions which you have not posted. That makes this code very hard to be adapted to someone else's environment. Their original post stated that they would send the libraries and the custom console app via email if required. I have requested them since I'd like to take a look at them.
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Terminal Server Maintenance - 2/21/2006 5:10:04 AM
|
|
 |
|
| |
turranx
Posts: 38
Score: 0
Joined: 2/7/2006
Status: offline
|
HiveEnum.exe is a safer way of obtaining a list of user registry hives than installing the hotfix. This particular hotfix wasn't regression tested. It's not likely to become an official patch, nor find it's way into Win2000 SP5 (if there ever is such a thing). Our development/test TS doesn't suffer from this inability to unload user registry hives, so I couldn't test the hotfix there. Stability of our TS is a major concern of ours and I hesitate to install an untested hotfix on our production TS. Description of Terminal Server behavior pre-script The production TS would occasionally display "Out of Registry Space" errors, then inform us it was automatically increasing our registry size. After a week of uptime (from a reboot), the TS became unstable. Users would attempt to log in but would receive one of two results: either the login attempt would "freeze" before the user was presented with a desktop, or they would be presented with a generic Guest desktop and receive a message that their registry hive could not be loaded. Furthermore, attempts to map to \\Terminal_Server\c$ would fail. The Terminal Services Manager utility I keep on my desktop couldn't connect to our TS. I had started to think there was a memory leak, so I installed poolmon.exe on our TS and began watching TS like a hawk. Below are some outputs from poolmon.exe. ------------------------------------------------------------------------------------------------------- Memory: 7601392K Avail: 6611496K PageFlts: 6629 InRam Krnl: 3292K P:109316K Commit:1072056K Limit:19690960K Peak:2092960K Pool N:44512K P:109508 Tag Type Allocs Frees Diff Bytes Per Alloc CM Paged 175897 ( 15) 164321 ( 14) 11576 51532512 ( 32) 4451 MmSt Paged 348435 ( 47) 339941 ( 92) 8494 14709856 (-127744) 1731 SavE Nonp 5224418 ( 901) 5223987 ( 901) 431 13320160 ( 0) 30905 --------------------------------------------------------------------------------------------------------- System Up Time: 13D 20H Problem: Zero available System Page Memory: 7601392K Avail: 6009760K PageFlts: 4538 InRam Krnl: 3192K P:170636K Commit:1731088K Limit:19690960K Peak:3100648K Pool N:30240K P:170920 Tag Type Allocs Frees Diff Bytes Per Alloc CM Paged 1704824 ( 4) 1680881 ( 4) 23943 107688384 ( 0) 4497 RadS Paged 317650747 (1453) 317647866 (1453) 2881 28105376 ( 0) 9755 MmSt Paged 11506291 ( 73) 11502628 ( 63) 3663 6899872 ( 25920) 1883 It wasn't until I installed the 'Debugging Tools for Windows' and read C:\Program Files\Debugging Tools for Windows\triage\pooltag.txt that I found out CM = Configuration Manager (registry). I thought CM = Cache Manager from all the reading I did on Microsoft.com. Once I learned the CM process handled the registry, I inspected HKEY_USERS and found many registry hives were loaded for users that weren't currently using the TS. The 'RadS' tag is for the Symantec Antivirus Corporate Edition service. How I handled the problem without the script I translated the name of each hive into a userID using GetSID.exe from www.sysinternals.com and made sure that user wansn't logged on. If they weren't logged on to the TS, I'd unload their hive using regedt32.exe. This was a long and drawn out task perfect for automating. As I did this, the Paged Kernel Memory (as is visible in the Performance Tab of Windows Task Manager) would drop from 170000 down to 120000 and responsiveness, connectivity, and user's ablity to log into TS would return to normal. Alternate Solution There is a 3rd party utility you can download from Microsoft called UPHClean: http://www.microsoft.com/downloads/details.aspx?FamilyID=1b286e6d-8912-4e18-b570-42470e2f3582&displaylang=en&Hash=SY534SC . Our resident TS expert installed UPHClean on our Test TS, but was unable to make it work properly. It was for this reason I automated the task. Response to EBGreen Arrays I tend to use a lot. You're probably right about Dictionaries; I should use them. I just haven't taken the time to learn them. :) My indentation habbits sometimes swing between tabbing (8 spaces) or just 1 space. It depends on the kind of mood I'm in when I write the script. I made sure that any objects I instantiated were also destroyed at the end of the loop. Of course, if you find one that I've missed, I'll correct my code. I've become so used to writing code with On Error Resume Next and writing my own error handling routines, that I usually only enable On Error Goto 0 when I'm debugging. It might seem backwards, but it works for me. :) The only reason I won't post the libraries is because I want to know who's reading/running/using my code. I'm interested in who's interested in my vbs babble. G.
_____________________________
Microsoft Windows 2000 Scripting Guide - The best book for newbie scripters http://www.myspace.com/Evil__Overlord
|
|
| |
|
|
|
 |
RE: Terminal Server Maintenance - 2/21/2006 5:47:12 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
quote:
I made sure that any objects I instantiated were also destroyed at the end of the loop. Of course, if you find one that I've missed, I'll correct my code. I wasn't concerned with object clean up. Garbage collection has become much better in recent releases of WSH. I was more concerned with the general implications of running an infinite loop. This script looks like it will essentially run constantly forever. I would tink that would be a processor ineficient implementation that's all. EDIT: Spelling.
< Message edited by ebgreen -- 2/23/2006 1:00:20 AM >
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Terminal Server Maintenance - 2/22/2006 3:52:30 PM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
thank you so much for your history and information on why you wrote this script. we are running 2003 on our TS server and have yet to run across this problem, so perhaps they fixed this problem in TS for 2003 but who knows. Our next step as our user base grows is to run a TS server farm with multiple nodes using the built in load balancing for TS, that should be interesting!
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
|
|