Category Archives: Scripts

Adding Registered Block List (RBL) checking in Exchange 2010

A usefull powershell command to add all of the most used black list servers:

Add-IPBlockListProvider -Name bl.spamcop.net -LookupDomain bl.spamcop.net -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://www.spamcop.net/w3m?action=checkblock&ip={0} for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name dnsbl.sorbs.net -LookupDomain dnsbl.sorbs.net -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://www.au.sorbs.net/lookup.shtml for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name zen.spamhaus.org -LookupDomain zen.spamhaus.org -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://www.spamhaus.org/query/bl?ip={0} for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name cbl.abuseat.org -LookupDomain cbl.abuseat.org -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://cbl.abuseat.org/lookup.cgi?ip={0} for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name b.barracudacentral.org -LookupDomain b.barracudacentral.org -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://barracudacentral.org/lookups/ip-reputation for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name spam.dnsbl.sorbs.net -LookupDomain spam.dnsbl.sorbs.net -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://www.au.sorbs.net/lookup.shtml for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name spam.rbl.msrbl.net -LookupDomain spam.rbl.msrbl.net -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://www.msrbl.com/check?ip={0} for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name bl.spamcannibal.org -LookupDomain bl.spamcannibal.org -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://spamcannibal.org/cannibal.cgi for further information. This organization has no control over this RBL (Realtime Block List)."
Add-IPBlockListProvider -Name psbl.surriel.com -LookupDomain psbl.surriel.com -Enabled $True -RejectionResponse "{1} has blocked your IP address ({0}) using the list '{2}'. Please see http://psbl.surriel.com/listing?ip={0} for further information. This organization has no control over this RBL (Realtime Block List)."
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Read More ...

Automated change password to scheduled Tasks

That’s a Usefull piece of code to change all the password of the schecduled tasks

Set WshShell = CreateObject("WScript.Shell")
PASS =InputBox("PASSWORD")
WshShell.Run "%comspec% /c " & chr(34) & "echo -------------------- %DATE% %TIME% -------------- " & chr(34) & " >>out.txt"
'

'-------- we use 2 vars , servidor where is the name of the server and tasca that is the name of the task
servidor="server"
WshShell.Run "%comspec% /c " & chr(34) & "echo --------------copies v-ioofi" & chr(34) & " >>out.txt"
tasca=chr(34) & "Nombre de tarea1" & chr(34)
WshShell.Run "%comspec% /c " & chr(34) & "schtasks.exe /change /s " & servidor &  " /RP " & PASS & " /TN " & tasca & chr(34) & " >>out.txt" ,1,true
tasca=chr(34) & "Nombre de tarea2" & chr(34)
WshShell.Run "%comspec% /c " & chr(34) & "schtasks.exe /change /s " & servidor &  " /RP " & PASS & " /TN " & tasca & chr(34) & " >>out.txt" ,1,true
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Read More ...

How to send one mail

I hope not accuse me of spammer for posting this simple script, works with a simple SMTP authentication method
can be very useful for maintenance scripts or ads:

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "direccionemailorigen"
objEmail.To = "direccionemaildestino"
objEmail.Subject = "Asunto....."
objEmail.Textbody = "Cuerpo del mensaje ...."
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =  "smtpserver"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "dominio\usuario"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "contraseña"
objEmail.Configuration.Fields.Update
objEmail.Send
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Read More ...

Copy some files from pc’s to server

Script for copying a particular directory of several PC’s to a server, creating a folder for each PC (read pcs.txt file), the script uses the unc path of pcs, you need access to resources \\pc\c$ of the pc’s, therefore recommended for Active Directory environments or (with domain )

the file pcs.txt:

PC001;JOSE;
PC002;ANNA;
...

In this case it is to copy the archives of email and calendars of the Lotus Notes application.
I hope you like ,…

Const ForReading = 1
Const OverwriteExisting = TRUE
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'----------------------- en el fichero pcs.txt es donde estan los nombres de los pcs-------------
'------------------------pc01;PEPITO;
'------------------------pc02;JAIMITO;
Set objTextFile = objFSO.OpenTextFile _
("E:\Copias\PCS.txt", ForReading)
'------------------------------ leo todas las líneas de fichero-------------------------
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ";")
'-------------------- si no existe la carpeta destino la creo , la creo -------------------------
If not (objFSO.FolderExists("E:\Copias\" & arrServiceList(1)  )) Then
 Set objFolder = objFSO.CreateFolder("E:\Copias\" & arrServiceList(1) ) 
End If
'--------------------- compruevo que puedo acceder a la ruta unc para copiar los datos---------------
if objFSO.FolderExists("\\" & arrServiceList(0) & "\c$\ibm\lotus\notes\data\archive") then
  'objFSO.DeleteFile("E:\Copias\" & arrServiceList(1) & \ "*.*")
  intReturn = objShell.Popup("Copiando: " & arrServiceList(0) & " Usuario: " & arrServiceList(1), 3,"Informacio" ,64)
'------------------------Copio les dades cap al directori desti------------------------
  objFSO.CopyFile  "\\" & arrServiceList(0) & "\c$\ibm\lotus\notes\data\archive\*.*" , "E:\Copias\" & arrServiceList(1) & ""  , OverwriteExisting
end if
Loop
IntReturn = objShell.Popup("Fitxeros copiados", 3,"Información" ,64)
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Read More ...

Get the size of mailboxes exchange 2010

For novices in exchange 2010, a very useful command to see the sizes of the exchange mailboxes:

Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft DisplayName,TotalItemSize,ItemCount

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Read More ...

Categories

Subscribe to my Newsletter

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close