Mostrando entradas con la etiqueta PowerShell. Mostrar todas las entradas
Mostrando entradas con la etiqueta PowerShell. Mostrar todas las entradas

miércoles, 1 de febrero de 2023

Connect Exchange Online from powershell - Conectar a Exchange Online desde powershell

Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName x@x.com

jueves, 6 de octubre de 2022

PowerShell Network Configuration Commands Cheat Sheet / Chuleta Powershell configuración red

Get-NetAdapter | Select-Object InterfaceAlias , InterfaceIndex

Get-NetIPConfiguration
Remove-netipaddress -interfaceIndex 2
Remove-NetRoute NextHop "192.168.0.1"

Get-NetIPConfiguration

New-NetIPAddress -InterfaceIndex 2 -IPAddress 192.168.0.15 -PrefixLength 24 -DefaultGateway 192.168.0.1


Get-DnsClientServerAddress -InterfaceIndex 2
set-DnsClientServerAddress -InterfaceIndex 2 -ServerAddresses ("8.8.8.8","1.1.1.1")

lunes, 4 de octubre de 2021

Comandos útiles tipo linux en PowerShell

Tail

tail -f fichero.log
Get-Content "fichero.log" -Wait

tail -f fichero1.log fichero.log
Get-Content "fichero1.log","fichero2.log" -Wait

Get-Content "*.log" -Wait
Get-Content "*.logs" -Exclude "TS*.log","x.log","*202001*" -Wait

tail -n 10 fichero.log
Get-Content fichero.log -Tail 10

head -n 10 fichero.log
Get-Content "c:\important.log" -Head 10

Find

find . -name *.txt
 Get-ChildItem -Path "." -Recurse -Filter "*.txt" | Format-Table FullName

Para parámetros de tipo -d en find añadir -Directory, en caso de fichero (-f en find) añadir -File
Para que incluya ficheros ocultos -Force
Profundidad de directorios -Depth

Abreviaturas

 Get-ChildItem -> gci
 Get-Content -> gc
 Select-String -> sls
 Format-Table -> ft

miércoles, 27 de enero de 2021

Instalar aplicaciones de la MS Store vía powershell (.appx)

Usar Add-ApxPackage

Para todos los usuarios usar Add-ProvisionedAppPackage 

Por ejemplo para añadir un paquete en la imagen de sistema operativo que estamos usando (ene este casno no requiere fichero de licnecia) se usa:

Add-ProvisionedAppPackage  -Online -Skiplicense -PackagePath paquete.Appx

Para ver los links de descarga fácimente https://store.rg-adguard.net/

Si tiene dependencias habría que ponerlas de la siguiente forma:

Add-ProvisionedAppPackage   -Online -SkipLicense -PackagePath paquete.AppxBundle  -DependencyPackagePath paquete1.Appx,paquete2.Appx,paqueten.Appx

jueves, 13 de agosto de 2020

Ver servicio stop pending PowerShell y Parar

Get-WmiObject -Class win32_service | Where-Object {$_.state -eq 'stop pending'}

Ejemplo salida:

ExitCode  : 0
Name      : TermService
ProcessId : 1572
StartMode : Auto
State     : Stop Pending
Status    : Degraded

Matar proceso:

Stop-Process -ID 1572

Otros ejemplos para matar procesos:

Stop-Process -ID 1234 -Force

Stop-Process -Name wordpad -Force

Conexión remota powershell

Enter-PSSession -ComputerName HOST -Credential USUARIO

viernes, 24 de julio de 2015

Ver licencias asignadas en Office 365


  1. Instalar Asistente para el inicio de sesión de Microsoft Online Services para profesionales de TI 
  2. Instalar  Módulo de Azure Active Directory para Windows PowerShell (versión de 64 bits) 
  3. PowersShell
  4. import-module MsOnline
  5. $msolcred = get-credential
  6. connect-msolservice -credential $msolcred
  7. Get-MsolUser | Where-Object {$_.isLicensed -eq $True}

L2TP Ipsec Windows to Mikrotik eror 789

 Add this to registry REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d...