Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Notas Del Curso Power Shell 2019 Universidad Mayor de San Simon PDF
Notas Del Curso Power Shell 2019 Universidad Mayor de San Simon PDF
Frases Celebres
¿Qué es PowerShell?
Primeros pasos
Comandos:
Verbos usados: get, set, write, start, stop, remove, add, etc
Formato:
[cmdlet]
[cmdlet] -[parametro]
[cmdlet] -[parametro] –[parametro] [argumento]
[cmdlet] -[parametro] –[parametro] [argumento1],
[argumento2]
Cmdlets básicos:
Get-Help
Get-Command
Get-Help [cmdlet]
Get-Alias
Get-Childitem
Clásicos:
CMDLET Alias
Get-Childitem dir
Get-Location pwd
Set-Location cd
Administración:
Get-Service
Get-Process
Stop-process
Salida standard:
Write-host
Salida a un archivo:
Política de ejecución:
Get-ExecutionPolicy
Set-ExecutionPolicy
Mas ejemplos...
Pipes
Get-Process | Get-Member
Get-Process | Sort-Object
Formateo de Salida
Ej.
Expresiones:
35 * 7
(200/6.9)
Variables:
Ej.
$ps = Get-Process
$ps
$ps[0]
$CambioDolar = 35*6.97
$CambioDolar
Variables Pre-definidas:
Set-Location variables:
Get-ChildItem
Variables especiales:
Ej.
Set-Location c:\noexiste
$Error
(Get-Service tlntsvr).DisplayName
(Get-Service tlntsvr).get_status( )
Comparaciones:
-lt <
-le <=
-gt >
-ge >=
-eq Equal to
-ne !=
-like
-notlike
-match
Ej.
Procesando Archivos
Leer/Agregar contenido a archivo de texto:
Get-Content C:\boot.ini
Copiar/Mover/Remover
Listar recursivamente
Agrupar Elementos:
Procesos/Servicios
Stop-Process [ID]
Start-Service –name [nombre servicio]
Registro de Windows
Acceder al registro:
Set-Location Registry::
Get-Ch ildItem
Set-Location
HKLM:\software\microsoft\windows\CurrentVersion
Listar claves:
Set-Location
HKLM:\software\microsoft\windows\CurrentVersion\run
Get-ItemProperty .
Set-Location
HKLM:\software\microsoft\windows\CurrentVersion\
Get-ItemProperty run
Agregar Clave:
Set-Location
HKLM:\software\microsoft\windows\CurrentVersion\
Set-ItemProperty -path . -name "PSInfo" -type "string" -
value "Agregado desde PowerShell"
Renombrar Clave:
Set-Location
HKLM:\software\microsoft\windows\CurrentVersion\
Rename-ItemProperty -path . -name PSInfo -newname
"PowerShell"
Get-ItemProperty .
Modificar Valor:
(Get-ItemProperty
HKLM:\software\microsoft\windows\CurrentVersion\Run).p
owershell = "Modificado desde Powershell"
Borrar Clave:
Remove-ItemProperty –path
HKLM:\software\microsoft\windows\CurrentVersion\Run –
name PowerShell
Listar logs:
Get-EventLog -list
Listar contenido:
Get-EventLog system