I am running this powershell script in order to pull Send-As permissions.
Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($.ExtendedRights -like "*send-as*") -and -not ($.User -like "nt authorityself")} | ft Identity, User -auto
I get the error "Deserialized objects exceed the memory quota". Can someone help me get passed this error? I don't want to change the maximum output and preferably would like to have it return multiple .csv files if I can work around this error.
Related
I am not a programmer, I must of taken a wrong turn! So that's out of the way, how on earth is there not an easy way to take a set of network folders and pipe out a list of AD security groups that are applied to it? I have googled my butt off but there are a million similar questions and i have tested a few scripts but cant get exactly what i want or a lot of errors. We have a top level directory of about 7 folders and security is about 3 levels deep. We want to cleanup unused or orphaned security groups out of AD TOOLS, and try to get a feel of what is used and what is not. Attempting a "Network drive cleanup" at my Organization.
What is the best way to accomplish this? I tried this in PS
Get-ChildItem "\\wfs.company.ca\adv\workgroups\adv services" -recurse | ForEach-Object {Get-Acl $_.FullName} | Export-CSV C:\"adv services".csv
It worked but gave me too much info and not specific Group names.
and i also tried something like this which just produced errors.
# Scope options are Universal, DomainLocal,Global
# Get-GroupMember -Scope DomainLocal
Function Get-GroupMember{
Param(
[parameter(Mandatory=$true)]
[string]
$scope
)
$Groups = Get-ADGroup -Filter {GroupScope -eq $scope -and Members -ne "NULL"} -Properties Name |
Select-Object Name, #{Name="GroupMembers";Expression={(Get-ADGroupMember -Identity "$_" |
Select-Object -ExpandProperty SamAccountName) -join "`n"}}
}
$Groups | Format-Table -AutoSize -Wrap
$Groups | Out-GridView
$Groups | Export-Csv C:\groups.csv -NoTypeInformation
I dont mind putting in the work and research i just dont know where to start.
Any pointers much appreciated.
Thanks!
You could use this to get a unique list of applied identities (groups and users):
(Get-ChildItem "\\wfs.company.ca\adv\workgroups\adv services" -Recurse | Get-Acl).Access.IdentityReference | select -Unique
Furthermore, you could use Get-ADGroup or other ways to check if it's a group or user.
When running Exchange Powershell "Get-EXOMailboxFolderStatistics" command on large mailbox (10's of thousands of folders) a timeout occurs and I have found no way of getting the results i need. My next step is to create a full command line application or UWP to achieve the administrative results needed.
Does anyone know of a way to retreive list of empty folders in this situation?
This works in normal mailboxes but returns timeout error in large mailbox:
Get-MailboxFolderStatistics $mailboxidentity |
Where {$_.identity -like "*Inbox*" -and $_.ItemsInFolder -eq 0} |
Select Identity |
Export-Csv -Path "c:\temp\emptyfolders.csv" -NoTypeInformation
Thanks!
I want to get office365 mailbox list which Last logon was more than 180 days? and export their .pst files to another location?
Wrote this script
But i am receiving error like - A parameter cannot be found that matches parameter name 'resultsize'
cant find where is the problem...
Get-MailboxStatistics -resultsize unlimited |
Where-Object {$_.LastLogonTime -lt (get-date).AddDays(-180)} |
Format-Table displayName,lastlogontime,lastloggedonuseraccount,servername
Get-MailboxStatistics has no -ResultSize argument. You should retrieve the mailboxes with Get-Mailbox and pipe results to get the statistics:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics
Get-Mailbox -Filter {AcceptMessagesOnlyFrom -ne $Null}
This code only return few users and it shows ProhibitSendQuota,
I would like to return all users that have message delivery restrictions configured to accept messages from and reject messages from.
*Additional info: the users are located in sample.net/sample DIV OU/IDM_Users
Looking back through my Exchange Scripts, I have this for getting Delivery Restrictions:
Get-Mailbox –ResultSize Unlimited |
Where-Object {$_.AcceptMessagesOnlyFromSendersOrMembers –ne "" –or $_.RejectMessagesFromSendersOrMembers –ne ""} |
Select Name,Alias,AcceptMessagesOnlyFromSendersOrMembers,RejectMessagesFromSendersOrMembers
I'm not able to test it as I don't use Exchange anymore, but it should still be correct.
I managed to solve it by using the following query.
Get-Mailbox -ResultSize Unlimited -OrganizationalUnit "OU=SAMPLE DIV OU ,DC=SAMPLE,DC=NET" |
where-object {$_.AcceptMessagesOnlyFromSendersOrMembers –ne “” –or $_.RejectMessagesFromSendersOrMembers –ne “”} |
select Name, alias, AccpetMessagesOnlyFromSendersOrMembers, RejectMessagesFromSendersOrMembers
The Get-Mailbox cmdlet has a -OrganizationalUnit parameter that I used to target the OU.
I know how to check who has Full Access or Send As permissions on a specific mailbox, but how can I check if a specific user has Full Access or Send As permissions on any mailbox?
By running Get-MailboxPermission cmdlet you can check which user/mailbox has what type of permissions to access other mailboxes in Exchange.
Check this helpful. And I'm sure it is what you was looking for.
http://exchangeserverpro.com/list-users-access-exchange-mailboxes/
And I also check this helpful
Get-Mailboxpermission for list of Mailboxes
This can be achieved by user the following powershell command:
Get-Mailbox | Get-MailboxPermission -User 'username'
The problem i run into that this doesn't include 'Security Groups' with mailbox permissions that a user might be member of.
If anyone knows how to solve this i would highly appreciate a reply.
Actually John Dane's answer is correct...it works for groups as well. The -User parameter accepts DistinguishedName or SamAccountName...both of which AD Security Groups have.
So just pass it the SamAccountName (or 'username') of your group and your golden. I used this to find out which mailbox an old group we were thinking about retiring had permissions to. I added a "| ft -autosize" to see the full identity field of the mailbox in the default output.
Get-Mailbox | Get-MailboxPermission -User 'SamAccountName'| ft -autosize
or just select the identity and access rights if that's all you need.
Get-Mailbox | Get-MailboxPermission -User 'SamAccountName'| select Identity,AccessRights | ft -autosize
With the following Command you don't have any missing entries:
Get-Mailbox -resultsize unlimited | Get-MailboxPermission | Where {(!$_.isinherited) -and ($_.user.SecurityIdentifier -ne "S-1-5-10") -and ($_.accessrights -contains "fullaccess") } | Select Identity,User | Export-Csv -Path "c:\temp\testmailboxpermissions.csv"