# Azure VM Powershell Can't run script using UNC path from other server, get not digitally signed error

**URL:** <https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601>\
**Category:** PowerShell Help\
**Created:** [July 15, 2023, 5:40pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601 "2023-07-15T17:40:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patilkishora](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@patilkishora](https://forums.powershell.org/u/patilkishora)\
**Post date:** [July 15, 2023, 5:40pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/1 "2023-07-15T17:40:20Z")

</div>

I am trying run PowerShell script on my server (Azure VM) which is available on Remote Machine (On-Premise / Azure VM) but get below error.  
I don’t want to change execution policy to Bypass or unrestricted, as it’s already working between on-premise to on-premise. script execute successfully using UNC Path.

Note: This blog not showing UNC path correctly (I am using \ \ in my UNC path)

PS C:\Users\19004-SA\Desktop\> Get-ExecutionPolicy  
RemoteSigned

PS C:\> & ‘\RemoteServer\c$\test.ps1’  
& : File \RemoteServer\c$\test.ps1 cannot be loaded. The file \RemoteServer\c$\test.ps1 is not digitally signed. You  
cannot run this script on the current system. For more information about running scripts and setting execution policy,  
see about\_Execution\_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.  
At line:1 char:3

- & ‘\RemoteServer\c$\test.ps1’
- 

```auto
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
```

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [July 15, 2023, 9:28pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/2 "2023-07-15T21:28:18Z")

</div>

Hi Patilkishora, welcome back to the forum

> [@patilkishora](#):
>
> This blog not showing UNC path correctly (I am using \ \ in my UNC path)

This is because you did not use the preformatted text option, it’s the little \</\> button (note it may be hidden under the settings wheel) Please always format any code/errors with this option. If you don’t want to change your policy, you can try copying the script to the local system and run it locally. Outside of that you can either sign the script, or perhaps use a onetime bypass while calling it.

```auto
powershell.exe -ex bypass -file \\RemoteServer\c$\test.ps1

```

---

<div class="post-metadata">

**Author:** ![patilkishora](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@patilkishora](https://forums.powershell.org/u/patilkishora)\
**Post date:** [July 15, 2023, 9:57pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/3 "2023-07-15T21:57:51Z")

</div>

I tried bypass & unrestricted option and script works through UNC path.  
I would like to understand the behavior of the Azure VM, because on on-premise server there is now issue.

Even if I try to execute script on Azure VM using UNC and script is on other Azure VM I get the same error. which is not the case in on-premise (VMWARE) servers.

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [July 15, 2023, 10:33pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/4 "2023-07-15T22:33:35Z")

</div>

I can’t see your environment so I won’t be much help. Are the machines domain joined? Have you checked the network category and make sure it’s not “public”?

```auto
Get-NetConnectionProfile

```

---

<div class="post-metadata">

**Author:** ![patilkishora](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@patilkishora](https://forums.powershell.org/u/patilkishora)\
**Post date:** [July 17, 2023, 2:37pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/5 "2023-07-17T14:37:15Z")

</div>

On-premise / Azure VM all these machines are in same domain.  
Only difference OS & Powershell Version

On-premise ( OS: 2012 R2, PS Version: 4.0  
Azure VM (OS:2019 , PS Version:5.1)

I checked network category and it’s not “Public” and same on both servers.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:14pm UTC](https://forums.powershell.org/t/azure-vm-powershell-cant-run-script-using-unc-path-from-other-server-get-not-digitally-signed-error/22601/6 "2024-05-16T20:14:47Z")

</div>

Closed on May 16, 2024, 8:14pm UTC


