Get-Mailbox and Export-CSV Question
Hi all - I was wondering if one of you PowerShell Wizards knew of an easy way to edit the script below to alllow me to enter a path to save the CSV file as opposed to pre-defining it in the following script. For instance, The script should ask me "Save
File to Location?" and allow me to enter a path and file name. Would this even be possible? Thank you!
Get-Mailbox
-Server Name
| Get-MailboxPermission
| where
{ ($_.AccessRights
-eq
“FullAccess”)
-and
($_.IsInherited
-eq
$false)
-and
-not
($_.User
-like
“NT AUTHORITY\SELF”)
} | Select-Object
Identity, User, IsInherited, IsValid, Deny
| Export-CSV
f:\MBFA.CSV
September 8th, 2010 7:42pm
Something
like this?
$file
= read-host "Save file to location"
get-mailbox
-Server Name
| Get-MailboxPermission
| where
{ ($_.AccessRights
-eq
“FullAccess”)
-and
($_.IsInherited
-eq
$false)
-and
-not
($_.User
-like
“NT AUTHORITY\SELF”)
} | Select-Object
Identity, User, IsInherited, IsValid, Deny
| Export-CSV
$file[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2010 8:03pm
mjolinor,
Thank You! That is all I need. And I learned more about PS scripting while doing it.
Thanks again,
Mike
September 8th, 2010 8:41pm
Glad to help :)[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2010 10:08pm