Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 18th, 2008, 10:24 AM
jpool jpool is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 7 jpool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 39 sec
Reputation Power: 0
Alert if certain file type exceed specified limit.

Hi there,

I have the following script that alerts me when my ost file reaches a certain size, set by what is in the script.

----------------------

Option Explicit
Dim FSO, File, strSize, strFile, alarmSize, WshShell, objshell, intMessage
' As scheduled scripts dont like arguments tell the script which file to check
strFile="C:\Documents and Settings\camjp5\My Documents\Exchange\outlook.ost"
' The size to check against in Megabytes
alarmSize=2

Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile("C:\Documents and Settings\camjp5\My Documents\Exchange\outlook.ost")
strSize = File.Size\1024\1024
If strSize > alarmSize Then

Set objshell = CreateObject("Wscript.Shell")

intMessage = Msgbox("Attention: Your Mailbox size is " & strSize & "Mb. The recommended limit is " & alarmSize & " Mb." & vbNewLine & vbNewLine & "You should archive your email into Personal Folders. Archiving aviods Outlook to slow down and reduces the possiblity of currupting items in you mail folders." & vbNewLine & vbNewLine & "If you wish to follow instructions on how to archive your mail click Yes. Otherwise click No.", _
vbYesNo+48, "Microsoft Outlook")

If intMessage = vbYes Then
' Website or document that will host the relevant information
objShell.Run("URL or document path")
Else
Wscript.Quit
End If

End If
Set File = Nothing
Set FSO = Nothing
Wscript.Quit(1)

----------------------

It works fine, but what I want it to do it to be able to run on multiple machines, so to have the script not be specific to my local documents, as we have profiles on our machines the path would differ from user to user, and the ost file name can also differ, depending on what they have saved it as.

Is there a way to just make it look for the file extension ".ost" in say 'C:\Documents and Settings' ?

Any help would be much appreciated.

Thanks,
Julian

Reply With Quote
  #2  
Old January 18th, 2008, 12:16 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is online now
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
--moved to the Windows Scripting forum.

Reply With Quote
  #3  
Old January 23rd, 2008, 11:58 PM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Novice (500 - 999 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 969 keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level)keep_it_simple User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 3 h 4 m 57 sec
Reputation Power: 280
Send a message via Yahoo to keep_it_simple
if you have active directory you can create a gpo or link to the script via user account on logon...

not sure this will do it for you....but may give you an idea...

Code:
 sComputer = "."

 Set oWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
 Set colItems = oWMIService.ExecQuery("Select * From Win32_ComputerSystem")

 For Each oItem in colItems
  aUsrProfName = Split(oItem.UserName,"\")
  sUsrProfName = aUsrProfName(1)
 Next

 Set FSO=CreateObject("Scripting.FileSystemObject")

 If FSO.driveexists("c:") = true then

  sMyDocsFolder = "c:\Documents and Settings\" & sUsrProfName & "\My Documents\"
   
  If FSO.folderexists(sMyDocsFolder) Then
   Set oMyDocsFolder = FSO.GetFolder(sMyDocsFolder)
  
   For Each oFile in oMyDocsFolder.Files
    If LCase(Right(oFile.Name, 4)) = ".ost" Then
     sFileName = oFile.Name
     bFileFound = true
     Exit For
    End If
   Next

   If bFileFound Then
    alarmSize = 2

    Set File = FSO.GetFile(sMyDocsFolder & "\" & oFile.Name)

    sSize = File.Size\1024\1024

    If sSize > alarmSize Then

     Set objshell = CreateObject("Wscript.Shell")

     iMessage = Msgbox("Attention: Your Mailbox size is " & strSize & "Mb. " & _
                       "The recommended limit is " & alarmSize & " Mb." & _
                        vbNewLine & vbNewLine & "You should archive your email " & _
                       "into Personal Folders. Archiving aviods Outlook to slow " & _
                       "down and reduces the possiblity of currupting items in " & _
                       "you mail folders." & vbNewLine & vbNewLine & "If you wish " & _
                       "to follow instructions on how to archive your mail click Yes. " & _
                       "Otherwise click No.", _
                        vbYesNo+48, "Microsoft Outlook")

     If iMessage = vbYes Then
      objShell.Run("URL or document path")
     Else
      Wscript.Quit
     End If
    End If
   End If
  End If
 End If
Comments on this post
Nilpo agrees: Nice response.

Reply With Quote
  #4  
Old January 28th, 2008, 03:30 PM
jpool jpool is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 7 jpool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 39 sec
Reputation Power: 0
Thanks for that. Will play around and give it try

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > Alert if certain file type exceed specified limit.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway