You REALLY don't want me to throw a LMGTFY at you, do you?

OK, you asked for it:

http://www.lmgtfy.com/?q=Exchange+2007+get-messagetrackinglog+permissions

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: David Lum [mailto:david....@nwea.org]
Sent: Friday, October 22, 2010 5:51 PM
To: MS-Exchange Admin Issues
Subject: RE: PS script in batch troubleshooting - DOH, almost!

Crap...the batch file works, unless I call it as a scheduled task. It does call 
the .PS1 script (which I have as Michael scripted it) but it fails at the last 
line:
get-messagetrackinglog -messagesubject "NWEA password" -Start $shortdate  | 
Select sender,messagesubject | ft -auto

I narrowed it down to permissions - it runs OK as me (Exchange Organization 
Admin) but not as a regular user. What perms are required to open the message 
tracking log and search it?

Dave

From: David Lum [mailto:david....@nwea.org]
Sent: Friday, October 22, 2010 1:57 PM
To: MS-Exchange Admin Issues
Subject: RE: PS script in batch troubleshooting

As always, you guys are bombdigigty, I'm set! ! Michael this is a second part 
of the tool you helped me with for the password reminder e-mail. We put it into 
"production" last week. This piece here let's me schedule a job to see who got 
the password reminder sent to them as a CYA piece for my Service Desk guys.

Secondarily it lets me confirm the tool has run each night :).

Dave


From: Michael B. Smith [mailto:mich...@smithcons.com]
Sent: Friday, October 22, 2010 1:52 PM
To: MS-Exchange Admin Issues
Subject: RE: PS script in batch troubleshooting

For Exchange 2007, you need to add this command: "Add-PSSnapin 
Microsoft.Exchange.Management.PowerShell.Admin".

If you want to make it a "good" script, you'll do something like:

## the below code is Exchange 2007 specific

Get-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -EA 0
if ($?)
{
                ## snap-in already loaded, do nothing
}
else
{
                Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
}
$date = Get-date
$shortdate = $date.ToShortdateString()
get-messagetrackinglog -messagesubject "NWEA password" -Start $shortdate  | 
Select sender,messagesubject | ft -auto

put all the above in a PS1 file. In the cmd/bat file:

                powershell.exe -command "&{ c:\scripts\myscripts.ps1 }"

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: David Lum [mailto:david....@nwea.org]
Sent: Friday, October 22, 2010 2:44 PM
To: MS-Exchange Admin Issues
Subject: RE: PS script in batch troubleshooting

Thanks.
Exchange 2007.

Can I have a .CMD call a PS1 file and call it good?

Dave

From: Campbell, Rob [mailto:rob_campb...@centraltechnology.net]
Sent: Friday, October 22, 2010 11:27 AM
To: MS-Exchange Admin Issues
Subject: RE: PS script in batch troubleshooting

Nope.

I believe the problem is that when you run it from the PS command line, it's 
actually being run from an EMS command line.  The EMS is a generic Powershell 
console, with the modules or snapins (depending on your Exchange version) 
installed that implement the exchange specific cmdlets.

Since you're calling a generic Powershell instance from cmd, it doesn't have 
those cmdlets, so it doesn't understand "get-messagetrackinglog".

What version of Exchange are you running?

From: David Lum [mailto:david....@nwea.org]
Sent: Friday, October 22, 2010 1:21 PM
To: MS-Exchange Admin Issues
Subject: PS script in batch troubleshooting

This works at the PS command line:
$date = Get-date ; $shortdate = $date.ToShortdateString() ; 
get-messagetrackinglog -messagesubject:"NWEA password" -Start $shortdate  | 
Select sender,messagesubject | ft -auto

This does NOT work in a .CMD file (simply adds "powershell.exe -command" to the 
front):
powershell.exe -command "$date = Get-date ; $shortdate = 
$date.ToShortdateString() ; get-messagetrackinglog -messagesubject:"NWEA 
password" -Start $shortdate  | Select sender,messagesubject  | ft -auto

Error message is "The term 'get-messagetrackinglog' is not recognized as a 
cmdlet, function, operable program, or script file. Verify the term and try 
again."

Is my date string in front messing it up?
David Lum // SYSTEMS ENGINEER
NORTHWEST EVALUATION ASSOCIATION
(Desk) 971.222.1025 // (Cell) 503.267.9764


---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

**************************************************************************************************

Note:

The information contained in this message may be privileged and confidential and

protected from disclosure.  If the reader of this message is not the intended

recipient, or an employee or agent responsible for delivering this message to

the intended recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited. If you

have received this communication in error, please notify us immediately by

replying to the message and deleting it from your computer.

**************************************************************************************************

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

**************************************************************************************************

Note:

The information contained in this message may be privileged and confidential and

protected from disclosure.  If the reader of this message is not the intended

recipient, or an employee or agent responsible for delivering this message to

the intended recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited. If you

have received this communication in error, please notify us immediately by

replying to the message and deleting it from your computer.

**************************************************************************************************

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

**************************************************************************************************

Note:

The information contained in this message may be privileged and confidential and

protected from disclosure.  If the reader of this message is not the intended

recipient, or an employee or agent responsible for delivering this message to

the intended recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited. If you

have received this communication in error, please notify us immediately by

replying to the message and deleting it from your computer.

**************************************************************************************************

**************************************************************************************************

Note:

The information contained in this message may be privileged and confidential and

protected from disclosure.  If the reader of this message is not the intended

recipient, or an employee or agent responsible for delivering this message to

the intended recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited. If you

have received this communication in error, please notify us immediately by

replying to the message and deleting it from your computer.

**************************************************************************************************

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe exchangelist

Reply via email to