Download - Introducción a Powershell
![Page 1: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/1.jpg)
Maximiliano Marin Bustos
Microsoft Student Partner
http://blog.maximilianomarin.com
Twitter: @mmarinb
![Page 2: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/2.jpg)
![Page 3: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/3.jpg)
![Page 4: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/4.jpg)
Acepta, procesa y devuelve objetos .NET
Construida sobre CLR .NET y .NET Framework.
Amplía capacidades de cmd.
Integración con Sharepoint, SQL Server, Exchange, entre otros.
Estandarización de nombres.
Lenguaje de programación.
![Page 5: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/5.jpg)
Objetos
Partes
Manubrio
Ruedas
Pedales
Freno
Marco
Como se usan
Pedalear
Giro Izquierdo
Giro Derecho
Presionar freno
delantero
Presionar freno trasero
![Page 6: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/6.jpg)
Objetos
Atributos
DisplayName
Status
CanStop
MachineName
Métodos
Start
Stop
Pause
Refresh
…
Get-Service
![Page 7: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/7.jpg)
Demo«Conociendo Powershell y cambiando su aspecto»
$host.UI.RawUI.BackgroundColor = ‚black‛
$host.UI.RawUI.ForegroundColor = ‚green‛
![Page 8: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/8.jpg)
Cmdlet
Get-Command –Noun service
Verbo Sustantivo Parámetro
![Page 9: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/9.jpg)
Cmdlet
Get-Alias
Verbo Sustantivo
![Page 10: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/10.jpg)
Salida de un Cmdlet
Cmdlet
Objeto
Formateo por defecto
Salida de Texto
![Page 11: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/11.jpg)
Alias
• Provee un acceso fácil a cmdlets
• Existen alias pre definidos
• Creacion de Alias
• Exportar e Importar alias
![Page 12: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/12.jpg)
Demo«Comandos para NUNCA JAMAS OLVIDAR»
• Get-Help• Get-Command• Get-Member• Where-Object
![Page 13: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/13.jpg)
OperadoresOperador Uso
-eq Igual a
-ne Distinto a
-lt Menor a
-gt Mayor a
-ge Mayor o igual a
-le Menor o igual a
-match Coincide con
-notmatch No Coincide con
-like Es como (usando comodín *)
-notlike No es como (usando comodín *)
![Page 14: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/14.jpg)
Ciclos
for($i=0;$i –lt 5; $i++){echo $i
}
do{echo ’este es el ciclo do-while’$i++}while($i –lt 5)
while($i –lt 5){Echo ‘este es el ciclo while’$i++}
![Page 15: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/15.jpg)
Arreglos
• Estructura de datos que contiene mas objetos• Cada objeto tiene su propio container• Se accede a los container usando []
Objeto Objeto Objeto Objeto ………….
$serv = Get-Service
$serv[0] $serv[1] $serv[2] $serv[3]
Objeto
$serv[n]
![Page 16: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/16.jpg)
Formateo de Texto
• Format-table
• Format-wide
• Format-list
• Format-Custom
![Page 17: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/17.jpg)
Exportar a
• Convert-Html
• Convert-Html | out-file «archivo.html»
• Invoke-Item archivo.html
• Export-Csv archivo.csv
• Invoke-Item archivo.csv
![Page 18: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/18.jpg)
WMI
• Informacion sobre la maquina• Operaciones sobre la maquina• Administracion remota de maquinas• Conexiones protegidas con usuario y password
• List: Lista todas las clases disponibles• ComputerName: Maquina la que queremos administrar• Credential: Usuario y password• Conexiones protegidas con usuario y password• Class: Clase WMI a consultar• Namespace: Especifica el repositorio WMI
![Page 19: Introducción a Powershell](https://reader034.vdocumento.com/reader034/viewer/2022050720/5525c9f3550346446f8b49fe/html5/thumbnails/19.jpg)