Copying Files Over a PSSession

I recently bought a Raspberry Pi 3, and now that it’s running Windows IoT Core, I wanted to make it do something. So I wrote a basic UWP App and I was looking for a way to deploy it to the device. Luckily, WinRM is enabled on Windows IoT Core. This allowed me to use PowerShell to remote into the device and copy my appx package.

net start WinRm

$ip = "192.160.0.100"

Set-Item WSMan:\localhost\Client\TrustedHosts -Value $ip -Force

$PWord = ConvertTo-SecureString –String "p@ssw0rd" –AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential `
                         –ArgumentList "$ip\Administrator", $PWord

$session = New-PSSession -ComputerName $ip -Credential $Credential

Copy-Item -ToSession $session `
          -Path "C:\Users\brise\Downloads\worker.appx" `
          -Destination "C:\Data\Users\Administrator\Documents"

4 responses to Copying Files Over a PSSession

  1. 

    Would copying the file via an SMB share have been an option – eg \192.160.0.100\C$?

    Like

  2. 

    I’m a little confused…
    I thought all UWP apps had to run in the context of an app container?

    I’ve been struggling over the last week to automate deployment of an internal LOB application to several internal Windows 10 tablets. I’ve created a Powershell script that runs at user logon and tries to use Add-AppxPackage to install/update the application to the latest version.

    Is there a better way?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.