07-21-2023, 05:46 PM
I am trying to run a `cmd` file that calls a PowerShell script from `cmd.exe`, but I am getting this error:
> `Management_Install.ps1` cannot be loaded because the execution of scripts is disabled on this system.
I ran this command:
```lang-none
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
```
When I run `Get-ExecutionPolicy` from PowerShell, it returns `Unrestricted`.
```lang-none
Get-ExecutionPolicy
```
Output:
```lang-none
Unrestricted
```
***
> cd "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\"
> powershell .\Management_Install.ps1 1
>
> WARNING: Running x86 PowerShell...
>
> File `C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1` cannot be loaded because the execution of scripts is disabled on this system. Please see "`get-help about_signing`" for more details.
>
> At line:1 char:25
>
> + `.\Management_Install.ps1` <<<< 1
>
> + CategoryInfo : NotSpecified: (:) [], PSSecurityException
>
> + FullyQualifiedErrorId : RuntimeException
>
> C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\> PAUSE
>
> Press any key to continue . . .
***
The system is [Windows Server 2008][1] R2.
What am I doing wrong?
[1]:
> `Management_Install.ps1` cannot be loaded because the execution of scripts is disabled on this system.
I ran this command:
```lang-none
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
```
When I run `Get-ExecutionPolicy` from PowerShell, it returns `Unrestricted`.
```lang-none
Get-ExecutionPolicy
```
Output:
```lang-none
Unrestricted
```
***
> cd "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\"
> powershell .\Management_Install.ps1 1
>
> WARNING: Running x86 PowerShell...
>
> File `C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1` cannot be loaded because the execution of scripts is disabled on this system. Please see "`get-help about_signing`" for more details.
>
> At line:1 char:25
>
> + `.\Management_Install.ps1` <<<< 1
>
> + CategoryInfo : NotSpecified: (:) [], PSSecurityException
>
> + FullyQualifiedErrorId : RuntimeException
>
> C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\> PAUSE
>
> Press any key to continue . . .
***
The system is [Windows Server 2008][1] R2.
What am I doing wrong?
[1]:
[To see links please register here]