We help IT Professionals succeed at work.

Missing script Get-AntispamFilteringReport.ps1

johnvlahos
johnvlahos asked
on
The anti-spam reporting scripts don't seem to present on our Exchange 2010 server. Any idea why or where I can get them. Note anti-spam agents have been installed on hub transport and are functioning.

thanks,
jv
Comment
Watch Question

Maen Abu-TabanjehNetwork Administrator, Network Consultant
Top Expert 2011

Commented:
copy paste - save it to Get-AntispamFilteringReport.ps1, and move it c:\program files\Microsoft\Exchange Server\Scripts folder
# Copyright (c) Microsoft Corporation. All rights reserved.  
# 
# THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK
# OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER. 
#
param (
    [string] $report = $(throw $GetAntispamFilteringReport_LocalizedStrings.res_0000),
    $location = $null,
    [System.DateTime] $startDate = [System.DateTime]::MinValue,
    [System.DateTime] $endDate = [System.DateTime]::MaxValue,
    [System.Int32] $top = 10
)

Import-LocalizedData -BindingVariable GetAntispamFilteringReport_LocalizedStrings -FileName get-AntispamFilteringReport.strings.psd1
. .\AntispamCommon.ps1

## Get the log entries based on action, sort by agent, and output

switch ($report) {
 "connections"
 {
  get-AgentLog -location:$location -startDate:$startDate -endDate:$endDate |
   where {$_.Action -eq "Disconnect" -or $_.Action -eq "RejectConnection" } |
   foreach { $h = @{} } { $h[$_.Agent]++ } `
   { 
    $arr = new-object object[] $h.keys.count 
    $h.copyto($arr,0)
    $arr | 
    select Name, Value |
    sort Value -Descending |
    topN -top $top
   }
 }

 "commands"
 {
  get-AgentLog -location:$location -startDate:$startDate -endDate:$endDate |
   where {$_.Action -eq "RejectCommand" } | 
   foreach { $h = @{} } { $h[$_.Agent]++ } `
   { 
    $arr = new-object object[] $h.keys.count 
    $h.copyto($arr,0)
    $arr | 
    select Name, Value |
    sort Value -Descending |
    topN -top $top
   }
 }

 "messagesrejected"
 {
  get-AgentLog -location:$location -startDate:$startDate -endDate:$endDate |
   where {$_.Action -eq "RejectMessage" -or $_.Action -eq "RejectRecipients" } | 
   foreach { $h = @{} } { $h[$_.Agent]++ } `
   { 
    $arr = new-object object[] $h.keys.count 
    $h.copyto($arr,0)
    $arr | 
    select Name, Value |
    sort Value -Descending |
    topN -top $top
   }
 }

 "messagesdeleted"
 {
  get-AgentLog -location:$location -startDate:$startDate -endDate:$endDate |
   where {$_.Action -eq "DeleteMessage" -or $_.Action -eq "DeleteRecipients" } | 
   foreach { $h = @{} } { $h[$_.Agent]++ } `
   { 
    $arr = new-object object[] $h.keys.count 
    $h.copyto($arr,0)
    $arr | 
    select Name, Value |
    sort Value -Descending |
    topN -top $top
   }
 }

 "messagesquarantined"
 {
  get-AgentLog -location:$location -startDate:$startDate -endDate:$endDate |
   where {$_.Action -eq "QuarantineRecipients" -or $_.Action -eq "QuarantineMessage" } | 
   foreach { $h = @{} } { $h[$_.Agent]++ } `
   { 
    $arr = new-object object[] $h.keys.count 
    $h.copyto($arr,0)
    $arr | 
    select Name, Value |
    sort Value -Descending |
    topN -top $top
   }
 }
}

<#
.EXTERNALHELP get-AntispamFilteringReport-help.xml
#>

# SIG # Begin signature block
# MIIbKAYJKoZIhvcNAQcCoIIbGTCCGxUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQURDaj+OJ+ruT6HRlzZBnL5rpB
# uaOgghXnMIIEhTCCA22gAwIBAgIKYQX3HgAAAAAAMjANBgkqhkiG9w0BAQUFADB5
# MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVk
# bW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQDExpN
# aWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQTAeFw0wOTA3MTMyMzAwMThaFw0xMDEw
#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HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp
# b24xITAfBgNVBAMTGE1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQQIKYQPc9gAAAAAA
# DDAHBgUrDgMCGqBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcN
# AQkFMQ8XDTEwMDgwOTA4MzYzN1owIwYJKoZIhvcNAQkEMRYEFCzX/yNOH3Tf1nhN
# 6qDufjxPw1bFMA0GCSqGSIb3DQEBBQUABIIBAJZXQ03MOgrFrELBDKnq6cZwKuzf
# HwTo5IFG+5QwxvG9owFXXbIzmqKrZklt+L1J31YvQjSk5iWcQix2SNEN6XnsGUoB
# XSUM0f7Xy2LrszdBYAdwegXoVNBWfTv6BmE+Ey3it3yY+pFJznditc8tXIf3S9/f
# 9sBBOPmHG8JY8tRzSDk9ZNnwW3hO0BWGEEhcM+kB+WQzroPjIvqzJezTbujQCkTC
# piLvq+1G8CDXdsjK44WIS0d7X2PzJ/vb5hn4WNz/KrcmqGXtL40gyCCWUlvq39wN
# HsPDRaHHYgzyyq+69+i4v3KhGmY0Fb4XqgnKQ6ED1PSu7I3skPWWxbloN7k=
# SIG # End signature block

Open in new window

Author

Commented:
Thanks Jordanet - do I need the signature block as well?
Maen Abu-TabanjehNetwork Administrator, Network Consultant
Top Expert 2011

Commented:
all of the code from the begin to end signature block used by exchange for internal pruposes

Commented:
I would be curious as to whether the signature block is machine specific.  Anyway to check another instance and compare the signatures?
Maen Abu-TabanjehNetwork Administrator, Network Consultant
Top Expert 2011

Commented:
wls3 ...signature blocks generated automatically i pasted the original file from installation CD , so its not generated for the machine

Commented:
Ok.  I was really curious more as a generic Powershell question.  It had never occurred to me until I read this thread.  It makes sense that it would be the same much as signatures on assemblies are static.  Thanks jordannet.

Author

Commented:
Sorry that didn't work...here's the message:

"Executable script code found in signature block."
Maen Abu-TabanjehNetwork Administrator, Network Consultant
Top Expert 2011

Commented:
what if you deleted the signature lines?

Commented:
Unless you reduce the Execution Policy setting (to Bypass) it will not run.  An alternative I have used in the past is to create a script and execute the script without any signature using the -ExecutionPolicy Bypass option to call the powershell.exe itself.  Adding a shortcut on the desktop and adding this directly has worked for me when I didn't have time to add signatures to a script in a production environment.  The link in the shortcut would point to this:
C:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\somedirectory\wherever\you\store\your\scripts\script.ps1 -WindowStyle Hidden

Open in new window

Author

Commented:
Made some progress - found the script on the CAS server - but it won't run..I just get a ScriptHalted message...

Commented:
Are you familiar with the debug cmdlets? They can help you step through it.  Also, check the $Error object for details.

Author

Commented:
Thanks wls3 - it seems to choking here:

[string] $report = $(throw $GetAntispamFilteringReport_LocalizedStrings.res_0000),

Commented:
Unless you are overwriting the parameter it seems to be looking for some resource file.  Was this the only file missing from your collection/installation?  If you don't want to go with the pre-filled defaults specified in the param block, you need to pass something.  I suspect you need to find that referenced file/variable from the resources:
[string] $report = $(throw $GetAntispamFilteringReport_LocalizedStrings.res_0000),
    $location = $null,
    [System.DateTime] $startDate = [System.DateTime]::MinValue,
    [System.DateTime] $endDate = [System.DateTime]::MaxValue,
    [System.Int32] $top = 10

Open in new window

Author

Commented:
Pointed me in the right direction - thanks