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"
Would copying the file via an SMB share have been an option – eg \192.160.0.100\C$?
LikeLike
Not sure, I’d have to try that out.
LikeLike
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?
LikeLike
You’re right, I see where I went wrong, let me fix that up. Thanks for pointing it out. I change my strategy midway and forgot to change the wording. I used this to transfer the appx.
LikeLike