Powershell:Tu nuevo mejor amigo
Gonzalo Balladares – MVP ExchangeJorge Díaz – MVP Exchange
Gonzalo Balladares R.MVP Exchange ServerMCITP | MCTS | MCSA
Director del Grupo Latinoamericano de Usuarios de Exchange (www.msglue.org)Gerente Tecnologías de Activetrainer.cl([email protected])
[email protected]: @gballadareshttp://geeks.ms/blogs/gballadares
Jorge Patricio Díaz GuzmánMVP Exchange Server
Director del Grupo Latinoamericano de Usuarios de Exchange (www.msglue.org)Gerente Tecnología MS([email protected])
http://www.jorgepatricio.org
Agenda
Introducción a PowershellAdministración de WindowsAdministración de Hyper-VAdministración de Exchange/Lync
Qué es Powershell?
Entorno de ScriptingIntegrado con .net (modelo de objetos)
¿Por qué Powershell?
Key chages to IIS in R2
ASP.NET on Server Core
Integrated PowerShell Provider
Integrated FTP and WebDAV
New IIS Manager Modules
Configuration Logging & Tracing
Best Practices Analyzer
http://channel9.msdn.com/pdc2008/ES14/
Server Core Additions In Windows Server 2008 R2
.NET Framework in Server CoreSubset of .NET 2.0Subset of .NET 3.0
Windows Communication Framework (WCF)Windows Workflow Framework (WF)
Subset of .NET 3.5WF additions from 3.5LINQ
Subset of ASP.NET support for IISPowerShellWoW64 as an optional feature
http://channel9.msdn.com/pdc2008/ES06/
http://www.codeplex.com/PSHyperv
http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24017698
http://halr9000.com/article/716
Costly
http://technet.microsoft.com/en-us/library/ee806878.aspx
Sharepoint 2010
http://msdn.microsoft.com/es-es/library/cc281954.aspx
SQL Server
No tengo iPhone, pero …http://tinyurl.com/b62o8f
Exchange 2007/2010 –eq “Más fácil"
Exchange Server 2003 (VBScript) E2K7 (PowerShell one-liner)
Mailbox Statistics
Set listExchange_Mailboxs = GetObject("winmgmts:{impersonationLevel=impersonate}!\\COMPUTERNAME\ROOT\MicrosoftExchangeV2").InstancesOf("Exchange_Mailbox")
For Each objExchange_Mailbox in listExchange_MailboxsWScript.echo "AssocContentCount =” + objExchange_Mailbox.AssocContentCountWScript.echo " DateDiscoveredAbsentInDS =” + objExchange_Mailbox.DateDiscoveredAbsentInDSWScript.echo " DeletedMessageSizeExtended =” + objExchange_Mailbox. DeletedMessageSizeExtendedWScript.echo " LastLoggedOnUserAccount =” + objExchange_Mailbox. LastLoggedOnUserAccountWScript.echo " LastLogoffTime =” + objExchange_Mailbox. LastLogoffTimeWScript.echo " LastLogonTime =” + objExchange_Mailbox. LastLogonTime WScript.echo " LegacyDN =” + objExchange_Mailbox. LegacyDNWScript.echo " MailboxDisplayName =” + objExchange_Mailbox. MailboxDisplayNameWScript.echo " MailboxGUID =” + objExchange_Mailbox. MailboxGUID WScript.echo " ServerName =” + objExchange_Mailbox. ServerName WScript.echo " Size =” + objExchange_Mailbox. SizeWScript.echo " StorageGroupName =” + objExchange_Mailbox. StorageGroupName WScript.echo " StorageLimitInfo =” + objExchange_Mailbox. StorageLimitInfo WScript.echo " StoreName =” + objExchange_Mailbox. StoreName WScript.echo " TotalItems =” + objExchange_Mailbox. TotalItems Next
get-mailboxstatistics –server $servername
Database Mgmt
Dim StorGroup as New CDOEXM.StorageGroup
StorGroup.DataSource.Open "LDAP://" + DCServer + "/ CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
StorGroup.MoveLogFiles("C:\newlogPath", 0)
move-storagegrouppath -identity “First Storage Group“ –log "C:\newlogPath”
Recipient Mgmt
Dim objMailbox As CDOEXM.IMailboxStore
Set objMailbox = GetObject("LDAP://" + DCServer + "CN=FOO,CN=users," + DomainName)
objMailbox.CreateMailbox "LDAP://" + DCServer + "/CN=Private MDB,CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
enable-mailbox -identity domain\FOO –database “First Storage Group\Private MDB”
Arquitectura de Administración de Exchange 2007/2010
Process Boundary
CLI GUI
Setup
Exchange cmdletsConfiguration Data Objects/Access
PowerShell Data Provider
PowerShell Engine
Windows FormsEarly-bound objs
Windows FormsADO.NET
MAPIStore Registry
Meta
baseAD
Anatomía de Powershell
http://www.flickr.com/photos/ajari/2288043144/
http://www.flickr.com/photos/mnkyhead/3292809/
En el inicio fue el cmdlet
Verbo – Sustantivo
Clear – HostSet – ExecutionPolicyGet – HelpWrite – DebugRestart – Computer
No debo hacerlo durante la charla, pero … -whatif (qué pasaría) si lo hicieramos?
Tome – Café(Durante el break )
http://www.flickr.com/photos/dnorman/2249376120/
MicrosoftWindows, SQL Server,
IIS, Exchange
Otras compañías: IBM, VM Ware, etc.
Tus Scripts
http://www.flickr.com/photos/adactio/377537734/
La línea de Canalización
(Pipeline)
The PowerShell pipeline
Get-Process | Where { $_.handles –gt 500 } | Sort handles | Format-Table
Get-P
roce
ssC
mdle
t
Common Windows PowerShell Parser
Windows PowerShell Pipeline Processor
Where
-Obje
ctC
mdle
t
Sort -O
bje
ctC
mdle
t
Form
at-Ta
ble
Cm
dle
t
Alias Alias
Los Verbos
AddClearNewRemoveEnableDisableSetGet
Los 4 Fantásticos!
Get-commandGet-helpGet-memberGet-psdrive
DEMO
Recursos
MVA
www.microsoftmva.com
1. http://msevents.microsoft.com2. Buscar “Virtual Labs”3. Buscar “PowerShell”
Scripts Destacados para Exchange 2010
Exchange 2010 Powershell Scripting Resources
http://social.technet.microsoft.com/wiki/contents/articles/exchange-2010-powershell-scripting-resources.aspx
Scripting Guy: Use PowerShell to Create an Exchange 2010 Database Report
http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/28/use-powershell-to-create-an-exchange-2010-database-report.aspx
Powershell script to monitor Exchange Server 2010 Services – EMAIL Report
http://www.myexchangeworld.com/2010/07/powershell-script-to-monitor-exchange-server-2010-services-email-report/
www.facebook.com/comunidadesMS www.facebook.com/estudiantesMSwww.facebook.com/emprendedoresMS
@ComunidadesMS
LinkedIn: //linkd.in/comunidadesms Vimeo: www.vimeo.com/comunidadesmsYouTube: www.youtube.com/comunidadesms
Redes Sociales
Créditos
Presentación basada en:
Windows PowerShell: A Technical Overview
“Something old, something new, something borrowed and something blue”
Allan da Costa PintoWindows PowerShell [email protected]://blogs.msdn.com/allandcp
Powershell:Tu nuevo mejor amigo
Gonzalo Balladares – MVP ExchangeJorge Díaz – MVP Exchange