Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Finding when a Exchange Store last backed up via script

$
0
0

Dears, 

 has posted a script here Website  that could be useful to check when was the last time each Database has been backed up, the code goes like this 

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

On Error Resume Next
set conn = createobject("ADODB.Connection")
set mdbobj = createobject("CDOEXM.MailboxStoreDB")
set pdbobj = createobject("CDOEXM.PublicStoreDB")
set com = createobject("ADODB.Command")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
strNameingContext = iAdRootDSE.Get("configurationNamingContext")
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
mbQuery = "<LDAP://" & strNameingContext & ">;(objectCategory=msExchPrivateMDB);name,distinguishedName;subtree"
pfQuery = "<LDAP://" & strNameingContext & ">;(objectCategory=msExchPublicMDB);name,distinguishedName;subtree"
Com.ActiveConnection = Conn
Com.CommandText = mbQuery
Set Rs = Com.Execute
Wscript.echo "Mailbox Stores"
Wscript.echo
While Not Rs.EOF
mdbobj.datasource.open "LDAP://" & Rs.Fields("distinguishedName")
Wscript.echo Rs.Fields("name") & " Last Backed Up : " & mdbobj.LastFullBackupTime
wscript.echo 
Rs.MoveNext

Wend
Wscript.echo "Public Folder Stores"
Wscript.echo
Com.CommandText = pfQuery
Set Rs1 = Com.Execute
While Not Rs1.EOF
pdbobj.datasource.open "LDAP://" & Rs1.Fields("distinguishedName")
Wscript.echo Rs1.Fields("name") & " Last Backed Up : " & pdbobj.LastFullBackupTime
wscript.echo 
Rs1.MoveNext

Wend
Rs.Close
Rs1.close
Conn.Close
set mdbobj = Nothing
set pdbobj = Nothing
Set Rs = Nothing
Set Rs1 = Nothing
Set Com = Nothing
Set Conn = Nothing


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

My question is: is there any way to enable the script to read all Exchange Servers in the organization from a file ?

Regards,






Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>