Tuesday, 25 October 2011
Find memory/CPU reservation on all VMs
## retrieve the values for MemReservationMB for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,MemReservationMB
## retrieve the values for CPUReservationMhz for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,CPUReservationMhz
If you want to go through a set all VM memroyCPU reservations to "0" run the following
## set the MemReservationMB to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemReservationMB 0 -Confirm:$false
## set the CPUReservationMhz to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CPUReservationMhz 0 -Confirm:$false
Tuesday, 4 October 2011
VMware PS Script to export Datastores Information
$_ | Select Name,
@{N="Location";E={$_.Summary.Url}},
@{N="Type";E={$_.Summary.Type}},
@{N="Hosts Connected";E={$_.Host.Count}},
@{N="VMs Connected";E={$_.Vm.Count}},
@{N="Capacity";E={"{0:n2} GB"-f ($_.Summary.Capacity/1GB)}},
@{N="Provisioned";E={"{0:n2} GB"-f (($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB)}},
@{N="Free";E={"{0:n2} GB"-f ($_.Summary.FreeSpace/1GB)}}
} | Export-csv ("c:\VMreports\Datastore-"+$a+".csv")
Wednesday, 31 March 2010
Add Permissions for Client Users to Access Public Folder Content
When adding client permissions, you can either use predefined permission roles (which consist of specific access rights) or you can customize permissions by manually applying the available access rights. To specify the permissions for the client user, you can use the Add-PublicFolderClientPermission cmdlet or the AddUsersToPFRecursive.ps1 user management script.
Looking for other management tasks related to public folder permissions? Check out Managing Public Folder Permissions.
| If a client user already has a specific access right to a public folder, you can't add the same access right again. Therefore, if you use the AddUsersToPFRecursive.ps1 script, and the user already has one of the access rights that you're trying to grant, a warning will appear stating that the current access rights will be removed before new access rights are granted. |
You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Public folder client permissions" entry in the Mailbox Permissions topic.
| You can't use the EMC to add public folder permissions for a client user. |
This example adds Publishing Editor permissions for the user Kim to access the public folder West Coast.
Add-PublicFolderClientPermission -Identity "\Marketing\West Coast" -AccessRights PublishingEditor -User Kim
For detailed syntax and parameter information, see Add-PublicFolderClientPermission.
You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Public folder client permissions" entry in the Mailbox Permissions topic.
This example adds Reviewer permissions for the user David to access the top-level public folder Sales and all of the public folders under it.
AddUsersToPFRecursive.ps1 -TopPublicFolder "\Sales" -User "David" -Permission Reviewer
For more information about how to use public folder management scripts, see Scripts for Managing Public Folders in the Exchange Management Shell.
Thursday, 25 March 2010
Powershell Commands With Exchange 2003
er ExchServer | sort-object MailboxDisplayName | format-table MailboxDisplayName,Servername,StorageGroupName,StoreName,Siz
e,SentItems,TotalItems, DeletedMessageSizeExtended
Thursday, 28 January 2010
Exchange Powershell Commands
To gives full access permission to all the mailboxes
Get-Mailbox | Add-MailboxPermission -AccessRights Fullaccess -User
To remove mailbox permissions
get-mailbox -server "servername" | remove-mailboxpermission -user Domain\Username_here -AccessRights "FullAccess"
Bulk imports Mail contacts in to Exchange2007 via a CSV file
Import-Csv c:\csv\book1.csv | ForEach { New-MailContact -Name $_.displayName -Firstname $_.FirstName -LastName $_.LastName -ExternalEmailAddress $_.Emailaddress -Alias $_.Alias -OrganizationalUnit "london.HQNNET.com/London/Groups/Contacts" }
This is the book1.csv file that was imported - look at the format
DisplayName FirstName LastName Emailaddress Alias OrganizationalUnit
Ted Smith (Internet) Ted Smith ted.smith@easons.com tedsmith domain.com/London/Groups/Contacts
Get list of all mailboxes with all details and export to CSV file
Get-Mailbox | export-csv c:\csv\export.csv | Format-List
Get list of all Distribution Lists and export to CSV file
Get-DistributionGroup | export-csv c:\csv\DL.csv | FT Name, AddressListMembership
add full mailbox rights to a mailbox
Get-Mailbox -Identity server | Add-MailboxPermission -AccessRights fullaccess -User
to get a list of all users in a distribution list
Get-DistributionGroupMember -Identity "UK-Marketing Bulletin" | export-csv c:\DL.csv
to change the default search scope
To set the recipient scope to the Marketing Users OU in the contoso.com domain, run the following command:
$AdminSessionADSettings.DefaultScope = "contoso.com/Marketing Users"
To set the recipient scope to the contoso.com domain and use dc1.contoso.com as the recipient domain controller, run the following commands:
$AdminSessionADSettings.DefaultScope = "contoso.com"
$AdminSessionADSettings.PreferredDomainControllers = "dc1.contoso.com"
To set the recipient scope to the entire forest and use gc1.contoso.com as the global catalog server, run the following command:
$AdminSessionADSettings.ViewEntireForest = $True
$AdminSessionADSettings.PreferredGlobalCatalog = "gc1.contoso.com"
Test Outlook Web Services for a certain user and output them in to a DOS box
Test-OutlookWebServices -I gerrish@domain.co.uk | fl
To check wheather a group has sender auth enabled
Get-DistributionGroup “Group? | Select-Object Name, RequireSenderAuthenticationEnabled
to disabled sender auth
Set-DistributionGroup “Group? -RequireSenderAuthenticationEnabled $False
Get Transport Servers full details exported to a CSV file
Get-TransportServer | export-csv c:\will.csv | Format-List
Add a user as a public folder admin
Add-ExchangeAdministrator -Identity 'domain.contoso.com/Users/Paula' -Role:'PublicFolderAdmin'
Get-Mailbox | Get-MailboxStatistics | select DisplayName,TotalItemSize| sort TotalItemSize | export-csv c:\filename.csv
Get a list of all SMTP address of all users.
Get-Mailbox | select -expand EmailAddresses | %{$_.SmtpAddress}
Get a list of currently logged on users
Get-LogonStatistics -Server SRV | export-csv c:\export.csv | Format-List
Get details of managed by in email distribution list
Get-DistributionGroup | fl displayname, managedby
Get full details of any mailbox with certain words in it.
get-mailbox *word* | fl
Give a user full rights over public folders
Add-PublicFolderAdministrativePermission -User username -Identity \PublicFolder -AccessRights AllExtendedRights
Get Cluster InformationRunning a cluster res from CMD will show which Exchange Server is the current node in the cluster.
running a cluster group "Cluster Group" /moveto:ExchSrv01 will move the cluster back to ExchSrv01.
How to find out what server is accepting RPC Connection
get-mailboxdatabase | ft name,RpcClientAccessServer
Change which server a Mailbox with user for RPC connections.
Set-mailboxdatabase -Identity lonmbx1 -RpcClientAccessServer "ExchSrv01.domain.com"
Public Folder cmdlets: http://technet.microsoft.com/en-us/library/bb232202(EXCHG.80).aspx