PowerShell scripts do not start on Win2k8

PowerShell script exchange

PowerShell scripts do not start on Win2k8

Veeam Logoby liviu.tutuianu » Mon Dec 17, 2012 9:49 am

Dear all,

We have some Powershell scripts that start remotely VEEAM jobs from other VBRs. The VBRs are Win2k8 R2 (VEEAM 6.5). The servers from which the jobs are being started have Win2k3 or Win2k8 installed on them.

I saw that from time to time, the Powershell scripts from Win2k8 systems, didn't start. This was the error:
"XXXX.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-helpabout_signing" for more details.".

Of course that the execution of scripts is enabled and it works if we run it manually. After many hours of troubleshooting, we saw that the Powershell scripts run only if the user that is set to run the scripts, is logged on that server.

So, did any of you encountered this kind of problem and how did you solve it? So, this happens only on Win2k8. We don't have that problem on Win2k3 systems.

Thank you,
Liviu
liviu.tutuianu
Enthusiast
 
Posts: 40
Liked: never
Joined: Mon Jul 09, 2012 8:17 am
Full Name: Liviu Tutuianu

Re: PowerShell scripts do not start on Win2k8

Veeam Logoby v.Eremin » Mon Dec 17, 2012 10:10 am

Hi, Liviu.

I’m wondering whether this is your issue. In Windows Server 2008 R2 there are two versions of PowerShell - x64 and x86. So, you need to be sure that execution policies are set for both of them.

You can set the execution policy by typing this into your powershell window (it depends on what type of execution policy you're willing to use):

Code: Select all
Set-ExecutionPolicy RemoteSigned

Or

Code: Select all
Set-ExecutionPolicy Unrestricted

Furthermore, you're able to see what execution policy is being used in each instances of PS(x64,x86) by using Get-ExecutionPolicy method.

Hope this helps.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 971 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: PowerShell scripts do not start on Win2k8

Veeam Logoby liviu.tutuianu » Wed Dec 19, 2012 7:43 am

Dear Eremin,

The execution of policy is already set to unrestricted.

The OS is Win2k8 R2 64 bit. Also, Powershell 2.0 64 bit. The scripts are started using an external program called TWS, so I am not using a local Task Scheduler.

The same scripts on Win2003 and Powershell 2.0 32 bit work very fine.

So, none of you encountered this problem on Win 2k8 yet?


Thanks,
Liviu
liviu.tutuianu
Enthusiast
 
Posts: 40
Liked: never
Joined: Mon Jul 09, 2012 8:17 am
Full Name: Liviu Tutuianu

Re: PowerShell scripts do not start on Win2k8

Veeam Logoby v.Eremin » Wed Dec 19, 2012 7:57 am

Just for the purpose of complete understanding – you have set execution-policy to unrestricted in your Windows 2008 r2 for both of the PowerShell instances (x86, x64), not only for (x64)?

Sorry for the double-checking, since all that you have already mentioned indicates to the very common problem when a script can’t be run because execution-policy is set only for x64 instance.

Probably, I’m not so clear in my explanations. So, a typical solution for such issue would look like this:

1)Run PS x64 console in your Windows 2008 r2 and set what you need.
2)Then run PS x86 console and take the similar actions.

*Note – order, actually, doesn’t matter at all.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 971 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: PowerShell scripts do not start on Win2k8

Veeam Logoby liviu.tutuianu » Thu Dec 20, 2012 2:36 pm

Dear Eremin,

You are right. I didn't know that, if you have a Win 64bit OS, you will have two Powershell consoles: one for 64 bit and another for 32 bit. After setting the execution of policy on the X86 console, everything worked like a charm.

You rule!

Have an excellent day,
Liviu
liviu.tutuianu
Enthusiast
 
Posts: 40
Liked: never
Joined: Mon Jul 09, 2012 8:17 am
Full Name: Liviu Tutuianu

Re: PowerShell scripts do not start on Win2k8

Veeam Logoby v.Eremin » Thu Dec 20, 2012 2:45 pm

Hi, Liviu.

Glad to know you’ve finally solved your issue.

Should other questions regarding PowerShell snap-in or VB&R in general arise don’t hesitate to post it.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13290
Liked: 971 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 11 guests