Reputation: 151
I have a script to run a ps1 file using powershell ise on my local machine. & 'C:\Users\medetrax\Documents\Visual Studio 2013\Projects\Ward Obs Roaming\Ward Obs Roaming\AppPackages\Ward Obs Roaming_2.4.2.34_AnyCPU_Test\Add-AppDevPackage.ps1'
However I have now put that ps1 file on my server and wish to access it from powershell using shared folders. What script would I use in powershell for this
\\MEDEPADSERVER\Users\Public\app_folder\Ward Obs Roaming_2.4.2.34_AnyCPU_Test
I have tried net use \\MEDEPADSERVER\Users\Public\app_folder\Ward Obs Roaming_2.4.2.34_AnyCPU_Test
but I get network path errors so does anyone know of any scripts?
Upvotes: 1
Views: 3682
Reputation: 4198
You should still be able to execute the script via a UNC path from your local machine.
& '\\MEDEPADSERVER\Users\Public\app_folder\Ward Obs Roaming_2.4.2.34_AnyCPU_Test\Add-AppDevPackage.ps1'
Upvotes: 0
Reputation: 22871
You need to mount the share first, then access it using the path:
New-PSDrive -Name "Z" PSProvider Filesystem -Root \\MEDEPADSERVER\Users
Test-Path "Z:\Public\app_folder\Ward Obs Roaming_2.4.2.34_AnyCPU_Test"
If you get True
as a response, the drive is mapped correctly and you could execute the script as:
& 'Z:\Public\app_folder\Ward Obs Roaming_2.4.2.34_AnyCPU_Test\Add-AppDevPackage.ps1'
This assumes that you've set up a share on your server correctly and is named Users
and is pointing at the correct path on the server.
Upvotes: 1