Instalación de PowerShell en Windows - PowerShell | Microsoft Learn

PHOTO EMBED

Mon Aug 12 2024 17:47:53 GMT+0000 (Coordinated Universal Time)

Saved by @angel_leonardo1

# Replace the placeholder information for the following variables:
$deviceip = '<device ip address'
$zipfile = 'PowerShell-7.4.4-win-arm64.zip'
$downloadfolder = 'u:\users\administrator\Downloads'  # The download location is local to the device.
    # There should be enough  space for the zip file and the unzipped contents.

# Create PowerShell session to target device
Set-Item -Path WSMan:\localhost\Client\TrustedHosts $deviceip
$S = New-PSSession -ComputerName $deviceIp -Credential Administrator
# Copy the ZIP package to the device
Copy-Item $zipfile -Destination $downloadfolder -ToSession $S

#Connect to the device and expand the archive
Enter-PSSession $S
Set-Location u:\users\administrator\Downloads
Expand-Archive .\PowerShell-7.4.4-win-arm64.zip

# Set up remoting to PowerShell 7
Set-Location .\PowerShell-7.4.4-win-arm64
# Be sure to use the -PowerShellHome parameter otherwise it tries to create a new
# endpoint with Windows PowerShell 5.1
.\Install-PowerShellRemoting.ps1 -PowerShellHome .
content_copyCOPY

https://learn.microsoft.com/es-es/powershell/scripting/install/installing-powershell-on-windows?view