Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Working scripts

 
Logged in as: Guest
arrSession:exec spGetSession 2,5,46018
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Windows PowerShell >> Working scripts
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Working scripts - 4/17/2007 10:13:39 PM   
  andreas

 

Posts: 15
Score: 0
Joined: 4/12/2007
Status: offline
Hola

You guys made any nice working scripts yet?
Scripts that is wanted would be.

Check for process & kill it if xx mem usage or xx cpu util. or has been running for X amount of time.
Track usage of monitored applications, RDP client etc. (neet to log all RDP connections being made from all computers, in case of misuse.

Well most of my old scripts work well on vista. but would be sweet to see some good examples in powershell.
Less parsing makes more use. But from what i have seen parsing will still be a big part in the scripting industry ;:P
 
 
Post #: 1
 
 RE: Working scripts - 4/18/2007 1:19:14 AM   
  SAPIENScripter


Posts: 270
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
In Powershell, you may not need scripts in the same way you did with VBScript.  To kill high mem processes all you need is an expression like this:

get-process | where {$_.workingset -ge 100MB} | stop-process -confirm

You could also check CPU time.

If your VBScript scripts work, there shouldn't be any reason to re-invent the wheel. Unless you want to the Powershell experience or want to take advantage of a Powershell feature.

In VBScript, there can be a lot of parsing since you're often dealing with text. In Powershell, since you are using objects, pipelining is the trick:

get-process | where {$_.workingset -ge 50MB} | select Name,WorkingSet,StartTime | sort Starttime | format-table -auto

You might also check the Technet Script Center for Powershell examples.

_____________________________

Jeffery Hicks
Windows PowerShell MVP
SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com

Follow Me: http://www.twitter.com/JeffHicks

(in reply to andreas)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Windows PowerShell >> Working scripts Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts