tag:blogger.com,1999:blog-90563471319250586262024-03-05T08:16:33.897-08:00Get HelpSankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-9056347131925058626.post-66208781552523597572017-01-11T05:12:00.001-08:002017-01-11T05:12:27.027-08:00Impact of Leap Second<div dir="ltr" style="text-align: left;" trbidi="on">
<h1>
What is Leap Second:<o:p></o:p></h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: #1f497d;">A leap second is a
one-</span><a href="https://en.wikipedia.org/wiki/Second" title="Second"><span style="color: #1f497d; text-decoration: none; text-underline: none;">second</span></a><span style="color: #1f497d;"> adjustment that was added to </span><a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time" title="Coordinated Universal Time"><span style="color: #1f497d; text-decoration: none; text-underline: none;">Coordinated Universal Time</span></a><span style="color: #1f497d;"> (UTC) after midnight on 31<sup>st</sup> Dec 2016<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #1f497d;">Leap seconds are a periodic
one-second adjustment of Coordinated Universal Time(UTC) in order to keep a
system's time of day close to the mean solar time. However, the Earth's
rotation speed varies in response to climatic and geological events, and due to
this, UTC leap seconds are irregularly spaced and unpredictable. This article
seeks to provide information regarding the leap seconds, along with addressing.</span><span style="background: white; color: #333333; font-family: "Helvetica",sans-serif; mso-bidi-font-family: "Times New Roman"; mso-bidi-theme-font: minor-bidi;"> </span><span style="color: #1f497d;"><o:p></o:p></span></div>
<h1>
Impact of Leap Second:<o:p></o:p></h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: #1f497d;">Leap seconds help to keep clocks
aligned with Earth’s rotation, which can vary due to geologic and even weather
conditions. But an extra second can wreak havoc with applications and services
that depend on systems being tightly synchronized. Time synchronization is
critical for keeping replica up to date, determining which data-affecting
operation happened last, and correctly reporting the order of searches and
clicks, the company says.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: #1f497d;">Ordinary operating systems can’t
accommodate a minute that’s 61 seconds long, so some organizations have used
special-case workarounds for the extra second. But sometimes these methods
raise issues, like what happens to write operations that take place during that
second.<o:p></o:p></span></div>
<h1>
Solution:<o:p></o:p></h1>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
<span style="color: #1f497d;">Since the leap second was
inserted by IERS (International Earth
Rotation Services) at the moment<b>. </b>We all need to check with the
respective application vendor about this leap second whether they have a fix to
align with NTP. Obviously, we must install the fix if your application is not
synching with Network time protocol through internet. Keep your eye on scheduled jobs which used to
synch with external third party API’s <o:p></o:p></span></div>
</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-18488687860847129892016-03-29T02:52:00.002-07:002016-03-29T02:52:31.211-07:00Automation of resource pool allocation<div dir="ltr" style="text-align: left;" trbidi="on">
Operations teams are struggling to manage the resource pool. We have been either migrating or decommissioning lots of VM's everyday. We need to adjust the resource pool memory and CPU after every migration and decommission of VM's. <div>
<br /></div>
<div>
I have written the below powerCLI script to automate this task. This script will identify only discrepancy resource pool by comparing the resource pool memory and CPU share values with vCPU and memory count of VM's inside the resource pool.</div>
<div>
<br /></div>
<div>
By this way you can use an unused memory and CPU shares to another resources. </div>
<div>
<br /></div>
<div>
I have asked you to type the details of $VIserver, $SMTPserver, $mailFrom and $mailTo in the below script. Please add the requested details before running. You will get the discrepancy report of resource pool to your given "$mailTo" address after the completion of running script. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
#######################################################</div>
<div>
<br /></div>
<div>
# Created By = Sankar Munirathinam</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
########################################################</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> [string]$head = @'</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><style type = "text/css"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>p {font-family: Calibri;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>h1,h2,h3 {font-family: Calibri;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ol {font-family: Calibri;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>li {font-family: Calibri;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>table {width: 50%;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>table, th, td {border: 1px solid black;border-collapse: collapse; font-size:10pt}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>th {background-color:Orange; color:black}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>td, th {padding: 3px; text-align:center;}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></style></div>
<div>
'@</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
$VIserver = "Type your datacenter here"</div>
<div>
<br /></div>
<div>
Connect-VIserver $VIserver</div>
<div>
$report = @()</div>
<div>
</div>
<div>
$datacenters = get-datacenter </div>
<div>
<br /></div>
<div>
</div>
<div>
foreach($datacenter in $datacenters)</div>
<div>
{</div>
<div>
</div>
<div>
$clusters = get-datacenter $datacenter | get-cluster</div>
<div>
</div>
<div>
foreach($cluster in $clusters)</div>
<div>
{</div>
<div>
$Resourcepool = get-cluster $cluster | Get-ResourcePool | select -ExpandProperty Name</div>
<div>
</div>
<div>
foreach($resource in $Resourcepool)</div>
<div>
{</div>
<div>
</div>
<div>
$numvcpus = 0</div>
<div>
$totalmemory = 0</div>
<div>
$numvms = 0</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
$pool = get-resourcepool $resource -location $cluster</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>$cpuShares = $pool.Numcpushares</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>$MemoryShares = $pool.Nummemshares</div>
<div>
</div>
<div>
[int]$ClusterCPUShares = $cpuShares/1000</div>
<div>
[int]$clusterMemShares = $MemoryShares/1000</div>
<div>
</div>
<div>
$VMs = $pool | get-vm</div>
<div>
<br /></div>
<div>
</div>
<div>
foreach($vm in $VMs)</div>
<div>
{</div>
<div>
#count number of CPUs</div>
<div>
$NumvCPUs += ($VM).NumCpu</div>
<div>
#count how much memory is allocated</div>
<div>
$TotalMemory += ($vm).MemoryGB</div>
<div>
#count number of VMs</div>
<div>
$NumVMs += 1</div>
<div>
</div>
<div>
}</div>
<div>
<br /></div>
<div>
if((($numvcpus -lt $ClusterCPUShares) -or ($numvcpus -gt $ClusterCPUShares)) -or (($totalmemory -lt $clusterMemShares) -or ($totalmemory -gt $clusterMemShares)))</div>
<div>
{</div>
<div>
$totalmemory = "{0:N2}" -f $totalmemory</div>
<div>
</div>
<div>
$object = New-Object -TypeName Psobject</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "DataCenter" -Value $datacenter</div>
<div>
</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "Cluster" -Value $cluster</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "ResourcePool" -Value $resource</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Write-Host "--------------------------------------------"</div>
<div>
Write-Host "Cluster Name <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>$cluster" -ForegroundColor White</div>
<div>
Write-Host "Resource Pool Name <span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>$resource " -ForegroundColor White</div>
<div>
Write-Host "Resource Pool CPU Shares <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>$cpushares" -ForegroundColor White</div>
<div>
Write-Host "Total VM's vCPU Count<span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>$numvcpus" -ForegroundColor White</div>
<div>
Write-Host "--------------------------------------------"</div>
<div>
<br /></div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "ResourcePool Cpu Shares" -Value $cpuShares</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "Total VM's vCpu Count" -Value $numvcpus</div>
<div>
<br /></div>
<div>
Write-Host "--------------------------------------------"</div>
<div>
Write-Host "Cluster Name <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>$cluster" -ForegroundColor green</div>
<div>
Write-Host "Resource Pool Name <span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>$pool" -ForegroundColor green</div>
<div>
Write-Host "Resource Pool Memory Shares <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>$Memoryshares" -ForegroundColor green</div>
<div>
Write-Host "Total VM's Memory <span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>$TotalMemory GB" -ForegroundColor green</div>
<div>
Write-Host "--------------------------------------------"</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "ResourcePool Memory Shares" -Value $MemoryShares</div>
<div>
$object | Add-Member -MemberType NoteProperty -Name "Total VM's Memory in GB" -Value $totalmemory</div>
<div>
$report += $object</div>
<div>
}</div>
<div>
<br /></div>
<div>
}</div>
<div>
}</div>
<div>
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
$final = $report | ConvertTo-Html -Head $head</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
$SMTPServer = "Type your smtp address"</div>
<div>
$mailto = ""</div>
<div>
$mailfrom = ""</div>
<div>
$subject = "Report of ResourcePool $VIserver"</div>
<div>
<br /></div>
<div>
[string]$Message = @"</div>
<div>
<!DOCTYPE html></div>
<div>
<html></div>
<div>
<body style = "font-family: Calibri"; font-size:8px></div>
<div>
<font size = "3"></div>
<div>
<br /></div>
<div>
<p><center>$final</center></p></div>
<div>
<p>Regards</p></div>
<div>
<p><strong>Operation Team</strong></p></div>
<div>
</font></div>
<div>
</body></div>
<div>
</html></div>
<div>
"@</div>
<div>
<br /></div>
<div>
send-mailmessage -to $mailto -Subject $subject -from $mailfrom -smtpserver $SMTPServer -body $Message -BodyAsHtml</div>
<div>
##############################################</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
<br /></div>
<div>
<br /></div>
</div>
</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-82514246124906107842015-03-13T03:41:00.000-07:002015-03-13T03:41:44.040-07:00Message Tracking Log for Distribution Group<div dir="ltr" style="text-align: left;" trbidi="on">
Are you wondering how to take the transaction logs for distribution group?<br />
<br />
I have written an exchange powershell to take the logs of distribution group which are receiving the mails from external network. We need to specify the event id as Expand as mentioned in the below script.<br />
<br />
When you run Get-MessageTrackingLog on the hub server you could pull only the logs which are being sent the server where you are going to run this tracking log cmdlet.<br />
<br />
To get an accurate log report we should pull the transaction logs from all the hub transport server installed in the organisation<br />
<br />
How do you pull the tracking logs if you have multiple hub transport server?<br />
<br />
$Servers = Get-ExchangeServer | where { $_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true }<br />
<br />
We are saving all the hub server details in the $server variable to get the logs from all the hub server installed in the organization<br />
<br />
You just wanted to change the start date and end date based on the requirement. if you wanted to pull the logs for last 15 days you need to align with start and date in the below script.<br />
<br />
<br />
###############Get-Messagetrackinglog from all installed hub servers######################<br />
<br />
$Servers = Get-ExchangeServer | where { $_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true }<br />
<br />
$report = @()<br />
<br />
try {<br />
<br />
$logs = $servers | ForEach-Object { Get-MessageTrackingLog -EA SilentlyContinue -ResultSize Unlimited -Server $_.Name -Start (Get-Date).AddDays(-30) -End (Get-Date) -EventID Expand | select sender, RelatedRecipientAddress}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
foreach ($log in $logs)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$MSGSender = $log.Sender<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$DG = $log.RelatedRecipientAddress<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$Obj = New-Object PSObject<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$Obj | Add-Member -MemberType NoteProperty -Name "Sender" -Value $MSGSender<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$Obj | Add-Member -MemberType NoteProperty -Name"DistributionGroup" -Value $DG<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$report += $Obj<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
} catch {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
} finally {<br />
<br />
$report | Export-Csv C:\Users\sankar\Desktop\DG-MessageTracking.CSV<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
$report | Out-GridView<br />
}<br />
<br />
#####################################################################</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-53595611066880012192014-09-12T04:23:00.000-07:002014-09-18T04:00:55.855-07:00Advanced Search Query<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Use the Search-Mailbox cmdlet for the following scenarios</b><br />
<br />
1. Deleting the meetings from the end user calendar.<br />
<br />
2. Delete the Mail from the end user Mailbox<br />
<br />
3. Copy the mails from one mailbox to other mailbox<br />
<br />
4. Delete the meetings made by terminated users<br />
<br />
5. Delete the meeting from Resource mailbox<br />
<br />
<b><br /></b>
<b>Use the below cmdlet for taking the backup and see what emails you are going to recall. So if anything goes wrong you could use this backed up emails. </b><br />
<br />
<span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;">search-mailbox -searchquery "kind:meetings from:$recipient" -targetmailbox $yourmailid -targetfolder "REPORT" </span><br />
<span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;"><br /></span>
<span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;"><b>Check $yourmailid to see what meetings you are going to delete. If you are ok then go ahead and use delete parameter for deleting the meeting</b></span><br />
<span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;"><br /></span>
<span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;">search-mailbox -searchquery "kind:meetings from:$recipient" -deletecontent -force</span><br />
<b><span style="background-color: #ffffe5; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 14px; line-height: 21.7350006103516px;"><br /></span>
<span style="font-family: Georgia, Utopia, Palatino Linotype, Palatino, serif;"><span style="background-color: #ffffe5; font-size: 14px; line-height: 21.7350006103516px;">Use the below cmdlet for copying emails from one mailbox to another mailbox</span></span></b><br />
<span style="font-family: Georgia, Utopia, Palatino Linotype, Palatino, serif;"><span style="background-color: #ffffe5; font-size: 14px; line-height: 21.7350006103516px;"><br /></span></span>
<span style="background-color: #ffffe5; font-size: 14px; line-height: 21.7350006103516px;"><span style="font-family: Georgia, Utopia, Palatino Linotype, Palatino, serif;">Search-Mailbox mailid@domain.com -SearchQuery "Kind:email AND sent: 06/01/14..09/16/14" -TargetMailbox sankar@domain.com -TargetFolder Backup</span></span></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com1tag:blogger.com,1999:blog-9056347131925058626.post-46636997510501144632014-07-07T02:55:00.001-07:002014-07-09T02:04:58.666-07:00Powershell Error Handling<div dir="ltr" style="text-align: left;" trbidi="on">
There are two common parameters for error handling.<br />
<br />
<b>-Erroraction</b> and<b> -Errorvariable</b><br />
<br />
To know about common parameters:<br />
<br />
<span style="background-color: white; color: #424242; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 19.5px;"><b>Get-Help -Name about_CommonParameters;</b></span><br />
<br />
if an error occurs while running the script it will save that error in automatic variable<br />
<br />
Automatic variable :<b> $error</b><br />
<br />
Error handling is very important when you write scripts. You should know what is happening when the script is running. you could catch errors if the error occurs while running the script<br />
<br />
Syntax:<br />
<br />
Try<br />
{<br />
<br />
}<br />
catch<br />
{<br />
<br />
$_<br />
<br />
}<br />
<br />
Finally<br />
<br />
{<br />
<br />
}<br />
<br />
Put your scripts in Try block and Catch block would catch the errors while running the scripts.</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-14072899875707924182014-06-23T05:37:00.000-07:002014-09-12T03:35:47.682-07:00Remote Powershell<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
Use remote powershell if you dont have installed Exchange Management tool.<br />
<br />
Use the below script to log in through remote powershell<br />
<br />
$username = 'domain\username'<br />
$password = '**************'<br />
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))<br />
<br />
$session = New-PSSession -Authentication basic -Credential $cred -ConnectionUri https://*****.******.com/PowerShell -ConfigurationName Microsoft.Exchange<br />
Import-PSSession $session<br />
<br />
If you want to login to the different machine through remote use the below code<br />
<br />
$cred=Get-Credential<br />
$session = New-PSSession -Credential $cred -ComputerName <remote machine><br />
Enter-PSSession $sessio<br />
<br />
<b>To exit the remote session</b><br />
<br />
Exit-PSSession<br />
Remove-PSSession $session<br />
<br />
Powershell Execution policy<br />
<br />
if the powershell scripts to be allowed to run the scripts on your computer, Use the below execution policy cmdlets<br />
<br />
Set-ExecutionPolicy RemoteSigned<br />
<br />
Then use the below cmdlet to check the execution policy<br />
<br />
Get-ExecutionPolicy<br />
<br />
<br />
<br />
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-15386332498361039812014-05-09T02:27:00.001-07:002014-06-18T04:01:30.553-07:00Convert Powershell Script as Executable File<div dir="ltr" style="text-align: left;" trbidi="on">
How to convert the Powershell Script as Executable File?<br />
<br />
Sometimes we need to run the PS script as an executable file. In this case we could convert the powershell script as an exe file. Then run it on the windows OS. Please pay the attention on the Microsoft .Net Framework while creating the executable file.<br />
<br />
1. Install the latest version of PowerGUI Script Editor<br />
<br />
2. Write the script on the PowerGUI Script Editor which you want to convert it as EXE file<br />
<br />
3. Then Click on "Tools"<br />
<br />
4. Then Click on "Compile Script"<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic69wCfCsdyszNvkWiUaMqihjq1YC2gwP6pqq461yjDO5KeW8shT9d9oPRW84hOeLUHrXrXbHK7H3mTU9rDp8Gom0gAwXiCaIexDosAGGq4R46qhXImzJVTGBOofuUfIwUL2jr7XK0_H0_/s1600/ExecutableFile.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic69wCfCsdyszNvkWiUaMqihjq1YC2gwP6pqq461yjDO5KeW8shT9d9oPRW84hOeLUHrXrXbHK7H3mTU9rDp8Gom0gAwXiCaIexDosAGGq4R46qhXImzJVTGBOofuUfIwUL2jr7XK0_H0_/s1600/ExecutableFile.JPG" height="227" width="320" /></a></div>
5. If you want you can show powershell script on console. Else you could disable that option<br />
<br />
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-2758217977062027202014-01-22T03:43:00.001-08:002014-05-09T02:44:08.596-07:00Disk Usage Information <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<b><span style="color: blue;">Program to get Disk usage information </span></b></h2>
Use the below script to find the disk usage on windows. This script would be helpful when you want to work on disk utilization tasks such as cleanup process on disks, Auditing purpose etc,.<br />
<br />
Use this script to check the limit of disk utilization. And use Send-Mailmessage to send the alert to the specific person and schedule the script on task scheduler.<br />
<br />
function get-DiskUsage {<br />
<br />
Get-ChildItem -Recurse -Directory | Select-Object FullName,<br />
@{ Name="Size";<br />
Expression={ ($_ | Get-ChildItem |<br />
Measure-Object -Sum Length).Sum + 0 } }<br />
}<br />
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-81954676566309266862014-01-09T03:41:00.001-08:002014-09-02T02:50:40.233-07:00Make your Computer to speak with Powershell <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
Use the COM object to make the computer to speak. We could intimate the administrator using this computer speaking feature using powershell when they receive an error. This would be helpful to the scripting developer.</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: center;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: center;">Use the New-Object cmdlet to create the COM object as mentioned in the below screenshot.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMHng6LS6R7gL3p2Hl1_zxJAQUOdmFAmPskVJBlDRcZZ1yNkXc7yoXWi_fGbUN5prXo7oQbpbUBiMGKjpc8C8QUH7Cqox2XYq8ISEYKueERTCpaJpwY_FYwIijHnFBUlO7wgxGz-P9XxPT/s1600/Capture.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMHng6LS6R7gL3p2Hl1_zxJAQUOdmFAmPskVJBlDRcZZ1yNkXc7yoXWi_fGbUN5prXo7oQbpbUBiMGKjpc8C8QUH7Cqox2XYq8ISEYKueERTCpaJpwY_FYwIijHnFBUlO7wgxGz-P9XxPT/s1600/Capture.JPG" height="45" width="400" /></a></div>
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-6899967860424850142014-01-09T03:09:00.001-08:002014-06-24T02:21:08.897-07:00.Net Static Method<div dir="ltr" style="text-align: left;" trbidi="on">
How to list the static method using Get-Member cmdlet?<br />
<br />
Once you know the .net type, we can list the static method using the Get-Member.<br />
<br />
[System.Guid]::Newguid()<br />
<br />
[Sytem.Guid] -> .Net Type<br />
<br />
Newguid() -> .Net Method<br />
<br />
Have look at the below screenshot.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDbmPInwk_ZZkwaCtj9fWqbsnsldn3EWV-MsQyuiTYd5nkDVixW3vXYQGHlq7G4cP7X2QQCQALBjM4EIGto2ElnyAcxl84pWeZijaZ1ldsEm2cmmszCg2-8Ffh0kl8rh7hXpqNUJZne-6R/s1600/Untitled.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><br /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1W9fQkxRtMT1lERbs8ekUuio-w2bORCoMe4KYFGB9GQ5yq_z48dH4nAkpIrgDsLE2AV-qvjFoU2rb-ILbZXO84KYcXd3_RoHsljue79wi9Po9Co7UJ3OGLyWR-72bUfK9G9e1k-Y8nufF/s1600/.Net+Static.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1W9fQkxRtMT1lERbs8ekUuio-w2bORCoMe4KYFGB9GQ5yq_z48dH4nAkpIrgDsLE2AV-qvjFoU2rb-ILbZXO84KYcXd3_RoHsljue79wi9Po9Co7UJ3OGLyWR-72bUfK9G9e1k-Y8nufF/s1600/.Net+Static.JPG" height="211" width="400" /></a></div>
<br />
If you are in a situation to fetch the local machine timezone, you can use the method as mentioned in the below screenshot.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1O5T6SLdK6BvW5Ih1giqUrHdubS31aabkPR3uW26YYYMnyq9Y_Cg-8b52wjA4W5CzWYdHdwWAmVzn3Dqafi1VxoJBbuIf7pmUtoLM0z2XyVAUuke6M0UmzjcJrtbQ4F3rElMG7MWMrirN/s1600/Timezone.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1O5T6SLdK6BvW5Ih1giqUrHdubS31aabkPR3uW26YYYMnyq9Y_Cg-8b52wjA4W5CzWYdHdwWAmVzn3Dqafi1VxoJBbuIf7pmUtoLM0z2XyVAUuke6M0UmzjcJrtbQ4F3rElMG7MWMrirN/s1600/Timezone.JPG" height="60" width="400" /></a></div>
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-33257469271925107992013-02-13T05:44:00.001-08:002014-03-24T03:01:18.456-07:00Deleting the Meeting Requests Made by terminated users from all the roommailboxes<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Run this script on Exchange server 2010. You could delete the meetings made by terminated users from all the room mailboxes. Ensure that you are running this script only for terminated users. Else script will not run.<br />
<br />
Give the required input while running this script.<br />
<br />
<br />
<br />
[void][System.reflection.assembly]::LoadWithPartialName('microsoft.visualbasic')<br />
<br />
$recipient=[Microsoft.visualbasic.interaction]::inputbox("Enter the Recipient Name to delete the Meeting requests from all the room mailoxes","name","Sankar_M")<br />
<br />
<br />
$mailid=[Microsoft.visualbasic.interaction]::inputbox(" Enter your mail id to create a foler called REPORT in your outlook in which you can find the deleted contents","name","Sankar@Domain.com")<br />
<br />
if(get-recipient $recipient -warningaction:silentlycontinue)<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>[Microsoft.visualbasic.interaction]::msgbox("Recipient is Existing in Production. Ensure that You are running this program for Terminated User")<br />
<br />
Write-host "Recipient is Existing in Production. Ensure that You are running this program for Terminated User"<br />
<br />
break<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
else<br />
{<br />
<br />
[Microsoft.visualbasic.interaction]::msgbox("Hello, Please Wait Until the Program completes")<br />
<br />
Write-Progress -Activity "Preparing" -Status "Retrieving Roommailbox list" -PercentComplete 0<br />
$rooms=get-mailbox -recipienttypedetails roommailbox -resultsize unlimited -warningaction:silentlycontinue| where {$_.name -notlike "*test*"}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
$count=$rooms.count<br />
<br />
<br />
<br />
<br />
foreach($room in $rooms)<br />
<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$i=$i+1<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$percentage=$i/$count*100<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Write-Progress -Activity "Collecting mailbox details" -Status "Processing mailbox $i of $Count - $room" -PercentComplete $percentage<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$room | search-mailbox -searchquery "kind:meetings from:$recipient" -targetmailbox $mailid -targetfolder "REPORT" -deletecontent -force<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-6753916397336609502012-12-07T11:39:00.000-08:002012-12-07T11:39:03.252-08:00Powershell Help<strong>To get help in Graphical window</strong><br />
<br />
C:\> help Get-EventLog -showwindow<br />
<br />
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-80455259798501826512012-10-03T06:45:00.002-07:002014-09-18T04:29:54.628-07:00Powershell Tips<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to change the element of an array?</b><br />
<b><br /></b>
$array = 1, 2,3, 4, 5<br />
<br />
$array.Item(0) = 100<br />
<br />
$array<br />
<b><br /></b>
<b>How to sort an array ?</b><br />
<b><br /></b>
Use the static sort method from array class<br />
<br />
$a = 1,3, 4,2<br />
<br />
[array]::sort($a)<br />
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b>How to display Loaded and available Modules in Powershell?</b><br />
<b><br /></b>
Use the <b>Get-Module</b> cmdlet to display loaded<br />
<br />
To see the path of the module<br />
<br />
Get-Module | select path<br />
<br />
To list the modules,<br />
<br />
Get-Module -Listavailable<br />
<b><br /></b>
<b>How to open a pipeline results in editor?</b><br />
<b><br /></b>
dir | Out-File result.txt; notepad result.txt<br />
<b><br /></b>
<b><br /></b>
<b>How to list all parameters of parametersets?</b><br />
<b><br /></b>
PS C:\Users\sankar> (Get-Command Get-Date).parametersets | foreach {$_.parameters} | foreach {$_.name}<br />
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b>How to check the folder counts ?</b><br />
<br />
We can find the number of files available on desktop this way<br />
<br />
<br />
PS C:\Users\sankar\Desktop> @(get-childitem -name *).count<br />
<b>35</b><br />
<b><br /></b>
In case if you want to exclude some files when counting.<br />
<br />
@(Get-ChildItem -exclude *.txt).count<br />
<b><br /></b>
<b>How to exclude the files from displaying?</b><br />
<b><br /></b>
Get-ChildItem -exclude *.txt<br />
<br />
<b>How to get all the child items from the container that has child items?</b><br />
<br />
We should use -Recurse Parameter if we need to get all the child items from the container<br />
<br />
get-childitem -Recurse $env:USERPROFILE\desktop<br />
<br />
we can use -filter if we want to filter with some specified extension file like *.txt , *.docx etc<br />
<br />
get-childitem -Recurse $env:USERPROFILE\desktop -filter *.txt<br />
<br />
<b>How to check the version of Powershell and .Net Framework?</b><br />
<br />
<br />
PS C:\Users\sankar\Desktop> $PSVersionTable<br />
<br />
Name Value<br />
---- -----<br />
CLRVersion 2.0.50727.5456<br />
BuildVersion 6.1.7601.17514<br />
PSVersion 2.0<br />
WSManStackVersion 2.0<br />
PSCompatibleVersions {1.0, 2.0}<br />
SerializationVersion 1.1.0.1<br />
PSRemotingProtocolVersion 2.1<br />
<br />
<b>To check version for .Net Framework</b><br />
<br />
<br />
PS C:\Windows\Microsoft.NET\Framework> dir<br />
<br />
<br />
Directory: C:\Windows\Microsoft.NET\Framework<br />
<br />
<br />
Mode LastWriteTime Length Name<br />
---- ------------- ------ ----<br />
d---- 3/3/2012 8:27 AM v1.0.3705<br />
d---- 7/13/2009 10:20 PM v1.1.4322<br />
d---- 8/4/2012 9:22 AM v2.0.50727<br />
d---- 2/17/2011 9:25 PM v3.0<br />
d---- 3/3/2012 8:27 AM v3.5<br />
-a--- 11/4/2010 6:57 PM 86864 NETFXSBS10.exe<br />
-a--- 3/3/2012 2:50 AM 41392 netfxsbs12.hkf<br />
-a--- 6/10/2009 4:22 PM 13648 sbscmp10.dll<br />
-a--- 6/10/2009 4:22 PM 13648 sbscmp20_mscorwks.dll<br />
-a--- 6/10/2009 4:22 PM 13648 sbscmp20_perfcounter.dll<br />
-a--- 6/10/2009 4:22 PM 11104 sbs_diasymreader.dll<br />
-a--- 6/10/2009 4:22 PM 11088 sbs_iehost.dll<br />
-a--- 6/10/2009 4:22 PM 11112 sbs_microsoft.jscript.dll<br />
-a--- 6/10/2009 4:22 PM 11656 sbs_microsoft.vsa.vb.codedomprocessor.dll<br />
-a--- 6/10/2009 4:22 PM 11096 sbs_mscordbi.dll<br />
-a--- 6/10/2009 4:22 PM 11096 sbs_mscorrc.dll<br />
-a--- 6/10/2009 4:22 PM 11096 sbs_mscorsec.dll<br />
-a--- 6/10/2009 4:22 PM 11120 sbs_system.configuration.install.dll<br />
-a--- 6/10/2009 4:22 PM 11088 sbs_system.data.dll<br />
-a--- 6/10/2009 4:22 PM 11112 sbs_system.enterpriseservices.dll<br />
-a--- 6/10/2009 4:22 PM 11080 sbs_VsaVb7rt.dll<br />
-a--- 6/10/2009 4:22 PM 11104 sbs_wminet_utils.dll<br />
-a--- 6/10/2009 4:22 PM 13648 SharedReg12.dll<br />
<br />
<b>To Create New Item Using Powershell</b><br />
<br />
C:\Users\Sankar> New-Item <File Name> -ItemType File<br />
<br />
<br />
PS C:\Users\sankar\Desktop> 1..5 | %{New-Item<br />
-Name "$_.txt" -Value (Get-Date).tostring() -ItemType file}<br />
<br />
<b>NULL Value and Parameter Type</b><br />
<br />
<br />
PS C:\> Get-ChildItem $env:windr | ?{$_.length -eq $null}<br />
<br />
<br />
Directory: C:\<br />
<br />
<br />
Mode LastWriteTime Length Name<br />
---- ------------- ------ ----<br />
d---- 7/17/2012 2:11 PM Intel<br />
d---- 7/14/2009 8:07 AM PerfLogs<br />
d-r-- 11/12/2012 1:53 PM Program Files<br />
d---- 8/28/2012 2:43 AM Quarantine<br />
d---- 7/18/2012 12:02 AM source<br />
d-r-- 10/17/2012 8:25 PM Users<br />
d---- 12/7/2012 3:50 PM Windows<br />
<br />
<br />
function NULLValue<br />
{<br />
param<br />
(<br />
[string]$a = $( throw "Missing: parameter a"),<br />
$b = $( throw "Missing: parameter b")<br />
)<br />
<br />
if ($a -eq $null) { Write-Host "a is null" } else { write-Host "a is not null" }<br />
if ($b -eq $null) { Write-Host "b is null" } else { Write-Host "b is not null" }<br />
}<br />
<br />
If I call this function with: NULLValue $null $null<br />
<br />
I will get the following result:<br />
<br />
a is not null<br />
b is null<br />
<br />
<b>How to round the number?</b><br />
<br />
Use static Round method using math Class as mentioned below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihDzTTYTMBZgLHNWt18RZ9BdzCTivGbDolgWqEbybpt2H7zWplo_kAO5HMXnFNGKXlhyphenhyphenQNt4y_JS7Yq8yVDU0EkuDGqDWOR4ayeme5SiBu4Ol6HPhPc2VNH7Yu4k7dcyRW3nQ6uTtWsiYv/s1600/StaticRoundmethod.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihDzTTYTMBZgLHNWt18RZ9BdzCTivGbDolgWqEbybpt2H7zWplo_kAO5HMXnFNGKXlhyphenhyphenQNt4y_JS7Yq8yVDU0EkuDGqDWOR4ayeme5SiBu4Ol6HPhPc2VNH7Yu4k7dcyRW3nQ6uTtWsiYv/s1600/StaticRoundmethod.JPG" height="147" width="320" /></a></div>
<br />
<br />
<br />
<div>
<br /></div>
<br />
<div>
<br /></div>
<br />
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-74703937693091018982012-09-17T09:08:00.001-07:002012-09-17T09:13:11.551-07:00How to pull the report to only 500 group ids even if your organisation is having more than 10000 groups? <div dir="ltr" style="text-align: left;" trbidi="on">
For example, you are having more than 2000 groups in your organisation. Now you are in a situation to get the details of owners name of 500 groups only. How you will do?<br />
<br />
We can use Get-content to get the data from the text file with the path name mentioned and do the pipeline to the command like below<br />
<br />
<br />
[PS] C:\Users\sankar\desktop>$list = Get-Content .\groupid.txt | ?{$_ -ne ""} |%{$_.Trim()}<br />
[PS] C:\Users\sankar\desktop>$list.Count<br />
547<br />
[PS] C:\Users\sankar\desktop>$list | % {Get-DistributionGroup -Identity $_ -ResultSize Unlimited | Select-<br />
Object Name,@{L="ManagedBy";E={$_.ManagedBy}}} | Export-Csv -NoTypeInformation grouplistfromtext.csv<br />
<br />
<br /></div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-31427993763442251882012-09-07T08:43:00.001-07:002014-09-04T05:38:05.432-07:00Find out No longer Existing Group<div dir="ltr" style="text-align: left;" trbidi="on">
This exchange cmdlet would be helpful if you are dong auditing in your organization. You could filter no longer users details using last log on time.<br />
<br />
<br />
<pre class="prettyprint prettyprinted" style="border: 1px solid rgb(136, 136, 136); color: #2a2a2a; direction: ltr; font: inherit; line-height: 20px; list-style-type: none; overflow-x: auto; overflow-y: hidden; padding: 2px; vertical-align: baseline; word-wrap: normal;"><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Get</span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">-</span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">MailboxStatistics</span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">-</span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Server</span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><</span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">ServerIdParameter</span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">|</span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Sort</span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">-</span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Object</span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">LastLogonTime</span><span class="pln" style="border: 0px; color: black; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="border: 0px; color: #666600; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">–</span><span class="typ" style="border: 0px; color: #660066; font-size: 13px; font: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Descending</span></pre>
</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-63769565988597937532012-09-05T15:29:00.001-07:002014-09-04T05:27:59.993-07:00How to get the details of email addresses Using Powershell<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: x-small;"><span style="line-height: 21px;">We can use the below exchange cmdlet to pull the details of email addresses. Then export it to the CSV file using Export-CSV cmdlet. </span></span><br />
<span style="color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 13px; line-height: 21px;"><br /></span>
<span style="color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 13px; line-height: 21px;">Get-Mailbox -resultsize unlimited | Select Name,</span><span style="border: 0px; color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font: inherit; line-height: 21px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span style="border: 0px; color: #aa0000; font-family: Verdana, Tahoma, Arial, sans-serif; font: inherit; line-height: 21px; margin: 0px; padding: 0px; vertical-align: baseline;">@{Name=’EmailAddresses’;Expression={[string]::join(";", ($_.EmailAddresses))}}</span><span style="border: 0px; color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font: inherit; line-height: 21px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span style="color: blue; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 13px; line-height: 21px;">| Export-CSV EmailAddress.csv</span>
</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-32877767237422310942012-08-21T13:46:00.000-07:002012-08-21T13:46:32.303-07:00How to set the forwarding SMTP Address through Powershell<div dir="ltr" style="text-align: left;" trbidi="on">
You cannot set the Fowarding SMTP Address through EMC. But we can set it through EMC<br />
<br />
If you want to forward the mails from local mailbox to outside the organization, we should follow the below steps in powershell<br />
<br />
1. DeliverToMailboxAndForward:<br />
<br />
set-mailbox -DeliverToMailboxAndForward $true<br />
<br />
2. Forwarding Address<br />
<br />
set-mailbox intials -forwardingaddress Username<br />
<br />
3. ForwardingSMTPAddress<br />
<br />
set-mailbox intials -forwardingsmtpaddress email@domain.com</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-4619078072474183312012-08-09T13:20:00.000-07:002012-08-09T13:20:12.405-07:00Get Large Mailboxes from exchange<div dir="ltr" style="text-align: left;" trbidi="on">
Using the below script we can get the large mailboes report from the exchange 2007<br />
<br />
<br />Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where {$_.TotalItemSize -gt 500MB} `<br />| Select-Object DisplayName, ItemCount, TotalItemSize, TotalDeletedItemSize, StorageLimitStatus `<br />| Export-Csv "BigMailbox$(Get-Date -f 'yyyyMMdd').csv" -NoType<br />
</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-1301145680166546062012-08-03T15:50:00.003-07:002012-08-06T14:21:43.151-07:00How to set the pimary email address and making the existing one as secondary email address<div dir="ltr" style="text-align: left;" trbidi="on">
Here is the script to set the primary email address and making the existing as the secondary. if we do so, if anyone sending a mail to old email address, we can avoid the NDR<br />
<br />
<div class="csharpcode">
Import-Csv d:\alias.csv | Foreach-object { Set-Mailbox $_.alias -emailaddresspolicyenabled $false -PrimarySmtpAddress $_.SmtpAddress }</div>
<div class="csharpcode">
<br />
<br />
<strong>how to change the primary smtp using login id?</strong></div>
<div class="csharpcode">
<br /></div>
<div class="csharpcode">
$Users = Import-CSV c:\myfile.csv<br />
ForEach($User in $Users)<br />
{<br />
write-host "Processing $($User.loginid)"<br />
set-mailbox -identity $user.loginid -PrimarySmtpAddress $user.primaryemail -EmailAddressPolicyEnabled $false<br />
} </div>
<div class="csharpcode">
<br /></div>
<div class="csharpcode">
Regards,</div>
<div class="csharpcode">
Sankar M</div>
</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-45466990952289329852012-08-02T13:39:00.001-07:002012-08-02T13:39:23.602-07:00How to import file using Powershell<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 14pt; line-height: 115%;"><span style="font-family: Calibri;">How to Import the file using powershell <o:p></o:p></span></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Declare the variable to load CSV file.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6wPKIL4zNNLwn7FaRYLVfR3ENG7g56Szq9ErfyT-zNa6RqRgMyCGEzc8pq-jvRZMl4Ynmqp1jC6vd4jZRhl1iqTvLpa8B4pmAvHI8RodCyz77bZfckoX50eTcXVldtyVXUREiFaZGgbB9/s1600/report1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" eda="true" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6wPKIL4zNNLwn7FaRYLVfR3ENG7g56Szq9ErfyT-zNa6RqRgMyCGEzc8pq-jvRZMl4Ynmqp1jC6vd4jZRhl1iqTvLpa8B4pmAvHI8RodCyz77bZfckoX50eTcXVldtyVXUREiFaZGgbB9/s320/report1.jpg" width="320" /></a></div>
<span style="font-family: Calibri;">C:\temp>$V = import-csv c:\reprot.txt<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></span><o:p></o:p></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">If you want to see the ouput in console , just type the $v variable, you will be shown with<span style="mso-spacerun: yes;"> </span>content loaded into the text file<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Then we have run the script line by line, so we must use <b style="mso-bidi-font-weight: normal;">foreach</b> alias <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">$v | foreach { <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">If <o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">$_.hide –eq “yes”<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Write-host <span style="mso-spacerun: yes;"> </span>“ $_.name will be set as $true”<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">}<o:p></o:p></span></div>
</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-65955990150986188242012-07-30T14:43:00.001-07:002012-07-30T14:43:23.306-07:00Program for Helpdesk people to retrive the information of maiboxes<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">How to retrieve the Mailbox info from the particular mailbox server</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Using the below program, we can extract the details of mailbox information from the specified exchange server. Even if you type the mailbox name instead of typing exchange server name, you will get the mailbox info output. This program is very useful to Helpdesk people to retrieve the info of mailbox information and mailbox server information. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;"> Please <a href="http://messagingdevelopment.blogspot.in/#!/p/articles.html">Click Here</a> if you want to know about (if else) statement</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">If ($arg[0] –eq ‘server’)</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">{</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Write-Host “Retrieving info from the server ” $arg[1]</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Get-exchangeserver –server $arg[1] | select name, FQDN, ServerRole, Edition | FL</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Write-host “ The mailboxes Hosted on : “ $arg[1]</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Get-mailbox –server $arg[1] | select name, severname, database</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">}</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Else</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">{ </span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Write-host “ Retrieving information of maibox “ $arg[0]</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Get-mailbox $arg[0] |select name, servername, database</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">}</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Copy the program in notepad and save it as <b style="mso-bidi-font-weight: normal;">mailboxinfo.ps1</b></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Output:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">C:\temp>.\mailboxinfo.ps1 –server exchageserver1</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Retrieving info from the server<span style="mso-spacerun: yes;"> </span><b style="mso-bidi-font-weight: normal;">exchageserver1</b></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Name:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">FQDN:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Server Role:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Edition:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">The mailboxes Hosted on : <b style="mso-bidi-font-weight: normal;">exchageserver1</b></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Name:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Servername:</span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri;">Database: </span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Regards,</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">Sankar M</span> </div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-40980480135708970092012-07-25T13:33:00.001-07:002014-06-23T04:22:23.752-07:00Exchange Server Cmdlets<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;">1. quick shortcut to get all the commands</span></div>
<div style="text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><b>Get-Command
| Format-List Definition</b></span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><br /></span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;">2. How to move mailbox</span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><br /></span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><b>Get-Mailbox
-Server SRV1 | Move-Mailbox -TargetDatabase SRV2</b></span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><br /></span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><span style="line-height: 115%;">3. </span><span style="background-color: white;">To get a list of all users on an Exchange server who are not Unified Messaging-enabled type, </span></span></div>
<div style="text-align: left;">
<span style="background-color: white;"><span style="font-family: Times, 'Times New Roman', serif;"><b><br /></b></span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><b><span style="background-color: white;">Get-UmMailbox | ForEach { If($_.UmEnabled -Eq $False){$_.Name}}</span><span style="line-height: 115%;"> </span></b></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><br /></span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><span style="background-color: white; line-height: 115%;">4. </span><span style="background-color: white; line-height: 115%;">To
display the user’s alias formatted in a table together with the user’s Exchange server name and telephone extension, type:</span></span></div>
<span style="line-height: 115%;"><span style="font-family: Times, 'Times New Roman', serif;"><span style="line-height: 115%;"><br /></span><b><br />
<span style="line-height: 115%;">
Get-UmMailbox | Format-Table ServerName,@{e={$_.SamAccountName};Label=”User
Alias”},@{Expression=”Extensions”;Label=”Telephone numbers</span></b><br />
<br />
<span style="line-height: 115%;"></span><span style="line-height: 115%;">5. </span><span style="background-color: white;">If you want to test all IP Block
List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the
Test-IpBlockListProvider</span></span></span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><b>
Get-IpBlockListProvider | Test-IpBlockListProvider -IpAddress 192.168.0.</b>1 </span><span style="font-family: 'Times New Roman', serif; font-size: small;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: Times, 'Times New Roman', serif;">6. </span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"><b>Before you remove an object by using
the Remove verb, use the WhatIf parameter to verify the results are what you
expe</b>ct.</span><br />
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"><br /></span>
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">7. </span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Get all Win32 WMI information, such
as perfmon counters and local computer configurations. For example,</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>
Get-WMIObject Win32_PerfRawData_PerfOS_Memory </b><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">8. </span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">You
can configure real-time block list (RBL) providers with the Exchange Management
Shell by running the following two commands:</span></div>
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"></span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><b><br /></b></span></span></div>
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">
<b>
Set-IPBlockListProvidersConfig -Enabled $True -ExternalMailEnabled $True</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">And then</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><b><br />
Add-IPBlockListProvider -Name -LookupDomain -AnyMatch $True </b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><b><br /></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><b>9. </b></span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Access the event log from the
Exchange Management Shell. To retrieve the whole event log,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>
Get-EventLog Application | Format-List</b><br /><br />
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">To retrieve all Exchange-related events</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /><b>
Get-EventLog Application | Where { $_.Source -Ilike “*Exchange*” } </b><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b><br /></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>10. </b></span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">you can use wildcard characters to
retrieve all properties that matches the part of the name that you specify:</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>
Get-Mailbox | Format-Table Name,*SMTP* </b><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b><br /></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>11. </b></span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Do you want to configure a group of
objects that have similar identities? You can use a wildcard characters with
the Identity parameter when you use a Get cmdlet and pipe the output to a Set
cmdlet. Type:</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>
Get-Mailbox *John* | Set-Mailbox -ProhibitSendQuota 100MB</b><br /><br />
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">This command matches all mailboxes with the name “John” in the mailbox’s
identity and set the ProhibitSendQuota parameter to 100MB. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b><br /></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><b>Get-MailboxDatabase
“Normal” | Get-Mailbox | Set-Mailbox -ProhibitSendQuota 100MB</b><br />
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">This command retrieves all the mailboxes that reside in the “Normal”
mailbox database and sets their ProhibitSendQuota value to 301MB</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">12. </span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Use Test-MapiConnectivity to
troubleshoot connectivity problems between your users and your servers. Combine
Test-MapiConnectivity with a variety of cmdlets to target your specific issue
without having to manually dig for the information:</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b><br /></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>
Mailboxes: Get-Mailbox | Test-MapiConnectivity<br /><br />
</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>Mailbox databases: Get-MailboxDatabase | Test-MapiConnectivity<br /><br />
</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>Servers: Get-MailboxServer | Test-MapiConnectivity</b> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">13. </span><span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Do you want to record exactly what
happens when you’re using the Exchange Management Shell? </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">Use the<b> Start-Transcript
cmdlet.</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"> Anything that you do after you run this cmdlet will be recorded to a
text file that you specify. To stop recording your session, </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt;">use the<b>
Stop-Transcript cmdlet.</b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">
Notice that the Start-Transcript cmdlet overwrites the destination text file by
default. If you want to append your session to an existing file, use the Append
parameter:<br /><br />
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><b>Start-Transcript c:\MySession.txt -Append</b> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">14. How to check the Exchage server version, server role, site?</span><br />
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span style="line-height: 18.399999618530273px;"><b>Get-ExchangeServer | fl name, edition, serverrole, site</b></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"><br /><o:p></o:p></span></div>
</div>
Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-15758710267982413802012-07-24T10:08:00.000-07:002012-07-24T10:10:56.224-07:00Script For Folder Item Count<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<span style="font-family: Times New Roman;"><span style="font-family: Courier New;">I have been using the below exchange management command for the folders item count.</span></span><br />
<br />
<br />
<strong><span style="font-family: Courier New;">Get-Mailbox | Get-MailboxFolderStatistics | Where {$_.ItemsInFolder -gt 5000} | Sort-Object -Property ItemsInFolder -Descending | fl Identity, ItemsInFolder</span> </strong><br />
<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">Since there are different folder item limits for each version of Exchange, I thought it might be beneficial to write a script that could analyze folders on all versions, and determine if they were over their limit. The limits are as follows:</span><br />
<br />
<span style="font-size: x-small;"><span style="font-size: x-small;"></span></span> <br />
<br />
<strong>Version </strong> <strong>Folder Item Count</strong><br />
<br />
<br />
Exchange 2003 5,000<br />
<br />
Exchange 2007 20,000<br />
<br />
Exchange 2010 100,000<br />
<br />
<br />
<br />
<br />
Regards,<br />
Sankar M</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com0tag:blogger.com,1999:blog-9056347131925058626.post-56470472802197159322012-07-23T14:36:00.001-07:002012-07-24T09:02:22.763-07:00Script For Folder Count<div dir="ltr" style="text-align: left;" trbidi="on">
Hi,<br />
<br />
<strong>Using the below script we can dump the list of users and their folder size in exchange server 2010</strong><br />
<br />
<br />
<div class="MsoNormal">
<span style="color: #1f497d; font-family: "Calibri", "sans-serif"; font-size: 11pt;"><strong># script to list the number of folders in each mailbox</strong></span></div>
<div class="MsoNormal">
<span style="color: #1f497d; font-family: "Calibri", "sans-serif"; font-size: 11pt;">$mbx=get-mailbox </span></div>
<div class="MsoNormal">
<span style="color: #1f497d; font-family: "Calibri", "sans-serif"; font-size: 11pt;">$mbx|select Displayname,@{n="FolderIdCount";e={(get-mailboxfolderstatistics -id $_.Identity | select FolderId).count}} | Sort-Object -Property Displayname </span><span style="color: #984807; font-family: "Calibri", "sans-serif"; font-size: 11pt;">| export-csv c:\files\results.csv</span></div>
<div class="MsoNormal">
<span style="color: #984807; font-family: "Calibri", "sans-serif"; font-size: 11pt;"><br /></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<br />
<strong>If you want to know how many items are in every mailbox and if all items in mailbox is more than 500 you can use this below script:</strong><br />
<br />$data = $((get-date).ToString('dd.MM.yyyy'))<br />Function New-Array {,$args}<br />$Report = New-Array<br />$count_max = 500<br />$mbxs = get-mailbox | select -first 100 -resultsize unlimited<br />foreach ($mbx in $mbxs){<br />$mbxstat = get-mailboxstatistics $mbx.SAMAccountName<br />if ($mbxstat.ItemCount -gt $count_max){<br />
$report_tmp = New-Object System.Object<br />$report_tmp | Add-Member -type NoteProperty -name DisplayName -value $mbx.DisplayName<br />$report_tmp | Add-Member -type NoteProperty -name ItemCount -value $mbxstat.ItemCount<br />$Report += $report_tmp<br />
}<br />}<br />
$Report | ft -auto | Out-String -Width 4096 > d:\scripts\report_count_$data.txt<br />Send-MailMessage -To <a href="mailto:youremail@domain.com">youremail@domain.com</a> -From <a href="mailto:youremail@domain.com">youremail@domain.com</a> -Subject "Mailbox items count $data" -SmtpServer youremailserver -Attachments d:\scripts\report_count_$data.txt<br />
<br />
<br />
Regards,<br />
Sankar M</div>
</div>Sankar Mhttp://www.blogger.com/profile/13898504369438022766noreply@blogger.com1