Here is a litle script i’ve build by digging through differents article to match what i needed :


#Extracting the date
$day = get-date -Format dd
$month = get-date -format MM
$year = get-date -format yy
$hour = get-date -Format hh
$min = get-date -Format mm
$today = $day+$month+$year+"-"+$hour+$min
$myFile = "c:\DATA\stats" + $today + ".txt"

#Getting stats from each zone and send all to the text file
Get-DnsServerZone | select zonename | Get-DnsServerStatistics > $myFile

#Sending stats file per email
$PSEmailServer = "email server IP"
Send-MailMessage -From "dnsserver@domain.com" -To "who need the report@domain.com" -Subject $Today" DNS Stats" -Attachments $myFile

First save that into a .ps1 file and then run that through a schedule task with that batch file

@ECHO OFF
PowerShell.exe -Command "& ‘getstats.ps1’"
PAUSE

Tagged with:  

$job = Get-VBRJob -name "NameOfTheJob"
$job.GetObjectsInJob() | foreach { $_.Location }

reference : http://www.hiperlogic.com/blog/?p=323

Tagged with:  

In exchange powershell :

# Configure Virtual Directories for the “Default Web Site”

Set-WebServicesVirtualDirectory -Identity Exch2007\"EWS (Default Web Site)" -InternalUrl https://exch2007.yourdomain.com/ews/exchange.asmx -ExternalUrl https://exch2007.yourdomain.com/ews/exchange.asmx
Set-OabVirtualDirectory -Identity Exch2007\"OAB (Default Web Site)" -InternalUrl https://exch2007.yourdomain.com/OAB -ExternalUrl https://exch2007.yourdomain.com/OAB -RequireSSL:$True
Set-UMVirtualDirectory -Identity Exch2007\"UnifiedMessaging (Default Web Site)" -InternalUrl https://exch2007.yourdomain.com/unifiedmessaging/service.asmx -ExternalUrl https://exch2007.yourdomain.com/unifiedmessaging/service.asmx
Set-OWAVirtualDirectory -Identity Exch2007\"OWA (Default Web Site)" -InternalURL https://exch2007.yourdomain.com/owa -ExternalUrl https://yourdomain.com/owa -LogonFormat username -DefaultDomain internaldomain.com
# Set URL for AutoDiscover
Set-ClientAccessServer -Identity Exch2007 -AutodiscoverServiceInternalURI https://exch2007.yourdomain.com/autodiscover/autodiscover.xml -AutodiscoverSiteScope:$null
Set-AutoDiscoverVirtualDirectory -identity Exch2007\"Autodiscover (Default Web Site)" -InternalUrl https://exch2007.yourdomain.com/autodiscover/autodisover.xml -ExternalUrl https://exch2007.yourdomain.com/autodiscover/autodisover.xml
# Reset IIS
IISRESET -NoForce

Ref : http://www.msexchange.org/articles-tutorials/exchange-server-2007/migration-deployment/exchange-2007-install-configuration-command-line-part2.html
Tagged with:  
  • Get-MoveRequest -movestatus completed | remove-moverequest
Tagged with:  
  • The minimum result size is 1000, so if you have more user then we need to add the switch -resultsize
Get-Mailbox -resultsize unlimited | select name,database | export-csv "c:\mailboxperdatabase2.csv"
Tagged with:  

Sorry, this entry is only available in Français.

Tagged with:  

Do to so, we need to combine 2 commands and here we go !


get-MoveRequest | get-MoveRequestStatistics

 

Tagged with:  

1. In powershell :

Add-ADPermission -InheritedObjectType User -InheritanceType Descendents -ExtendedRights Send-As -User “BESAdmin” -Identity “DC=MonDomaine,DC=COM”

2. To validate that the command worked :

Get-Mailbox -Identity “Affichage du nom d’usager” | Get-ADPermission | where { ($_.ExtendedRights -like”*Send-As*”) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select Identity, User, ExtendedRights, IsInherited | FT -Wrap

Tagged with:  

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress, @{Name=”EmailA

ddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}

| export-csv c:\mail.csv

  1. get-mailbox -Organisation MyOrganisation = Affiche une liste de toute les boites de courriels de l’organisation spécifié
  2. get-mailboxdatabase = Affiche la liste complète de toutes les bases de données sur le serveur
  3. get-mailbox -Database MyDatabase = Affiche la liste de toutes les boites de courriels dans une base de données spécifique
  4. New-MoveRequest -Identity MyEmailAdress -TargetDatabase MyDatabase = Déplacement d’une boite de courriels dans une autre base de données
  5. Get-Mailbox -database MyDatabase | New-MoveRequest -TargetDatabase MyOtherDatabase -BatchName “MyDataBase to MyOtherDatabase” = Déplacement de tout les boites de courriels d’une base de données vers une autre
  6. Get-Mailbox -Database MyDatabase | select DisplayName, Alias, Database, PrimarySmtpAddress = Rajouter des valeurs dans la requête pour avoir plus d’information
  7. get-mailbox -Organization MonOrganisation -Identity MaBoite | Set-Mailbox -ForwardingAddress MonCourriel@monDomaine.com = Rajouter une redirection de courriel sur une boite de votre organisation
  8. Search-MessageTrackingReport -Identity “Frederick Lamontagne” -sender “grandmaman@fred.com” -BypassDelegateChecking -DoNotResolve = Sort tout les messages recu pour cet usager provenant de grandmaman@fred.com
Tagged with: