'Script written by L Mason v1.0 'This script adds a specified domain group 'To another specified local groupon a given machine.
Dim DomainName Dim UserAccount
Set net = WScript.CreateObject("WScript.Network") local = net.ComputerName DomainName = "mydomainname" 'enter your domain name here UserAccount = "mydomaingroup" 'enter the domain group set group = GetObject("WinNT://"&local&"/mylocalgroup") 'enter the local group
'adds the group. group.Add "WinNT://"& DomainName &"/"& UserAccount &""
'Written by Lee Mason 'Platform: Outlook VBA 'Purpose: Checks inbox for read mail and (in this case) moves it to 'an folder. Also counts unread mail in mailbox.
------------------
On Error goto 1000
'Declares and initialised variables Dim myOlApp As Application Dim myNameSpace As NameSpace Dim myibox As MAPIFolder Dim mydelitems As MAPIFolder Dim myitem As MailItem Dim n As Integer Dim unreadmail As Integer
n = 1 unreadmail = 0 Set myOlApp = CreateObject("Outlook.Application") Set myNameSpace = myOlApp.GetNamespace("MAPI") Set myibox = myNameSpace.GetDefaultFolder(olFolderInbox) Set mymovefolder = myibox.Folders("Old Items")
'Looks at items in the inbox and moves to 'Inbox/Old Items Folder if read, otherwise adds to the 'running count of unread items.
For n = 1 To myibox.Items.CountSet myitem = myibox.Items(n)If myitem.UnRead = True Thenunreadmail = unreadmail + 1Else: myitem.Move mymovefolderEnd IfNext n
'Check file age 'Written by Lee Mason 'This script uses FSO to calculate the age of file by finding the difference 'between its creation date and now. 'Useful for clearing out unused files by adding a simple delete operation to the if statement. 'I've included amsgbox operation for placeholding here.
'declare variables for fso Dim fol Dim fil Dim fso dim difftype dim maxage
Set fso = CreateObject("Scripting.FileSystemObject")
'set the TYPE of difference you want here, ie "D"=days, "M"=months "Y"=years difftype="D" 'set the maximum age of the file here maxage =2
'Add your own path here Set fol = fso.GetFolder("C:windows")
For Each fil In fol.files If DateDiff(difftype,fil.DateCreated,Now())>=maxage Then MsgBoxfil.name & " " & fil.DateCreated Next
'reclaim memory Set tf = Nothing Set fol = Nothing