Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Want to create a 32 bit remote powershell session

Posted on 2014-09-24
6
441 Views
Last Modified: 2014-09-25
This is what I do:

. E:\VMWare\scriptWithMyFunction.ps1	
$username = "username";
$password = ConvertTo-SecureString -String "password" -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$session = New-PSSession -Credential $cred -ComputerName "serverdnsname"
$a = Invoke-Command -Session $session -ScriptBlock ${function:myFunction} -ArgumentList $var1, $var2, $var3

Open in new window


However, this starts a 64 bit powershell session and when loading the VMware.VimAutomation.Core snapin, an error message gets thrown that states: "This cmdlet requires 32bit process."

So how can I make a 32 bit process and still do the above?
0
Comment
Question by:itnifl
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Dale Harris
ID: 40341192
Try opening the Powershell (x86) version on your computer, then run the script again.  See if that's the key.
0
 
LVL 2

Author Comment

by:itnifl
ID: 40341195
I run the script from System Center Orchestrator, which by default starts 32-bit Powershell 2.0. When Invoke-Command is used, this starts a 64-bit powershell 4.0 session. This source says 3.0, but I am jumping to the assumption that 4.0 was not there at the time? http://windowsitpro.com/orchestrator/call-windows-powershell-orchestrator
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 40341215
You'll need to call Invoke-Command (or in your case New-PsSession) with –ConfigurationName Microsoft.PowerShell32 to start a 32bit session.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 2

Author Comment

by:itnifl
ID: 40341419
Yeah, if that would only work. I have only seen documentation on Invoke-Command for PS 3.0 and PS4.0, not PS2.0 that Orchestrator uses by default. I have seen those suggestions on the internet/google, and it has not worked:

The error is simple when using the suggestion:
Invoke-Command : Parameter set cannot be resolved using the specified named parameters.

I have tried to out all the code in a function, then run invoke-command to run the function in PS4.0 64bit, then run invoke-command again inside that function remoting to the host with the following:

Invoke-Command -Session $session  –ConfigurationName Microsoft.PowerShell32 -ScriptBlock ${function:myFunction} -ArgumentList $var1, $var2, $var3,

Open in new window


Results in same error as above.
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40341547
This is an invalid combination of parameres - you can't provide -Session and -ConfigurationName at the same time. Either use
Invoke-Command -Credential $cred -ComputerName "serverdnsname" -ConfigurationName Microsoft.PowerShell32 -ScriptBlock ${function:myFunction} -ArgumentList $var1, $var2, $var3

Open in new window

or
$session = New-PSSession -Credential $cred -ComputerName "serverdnsname" -ConfigurationName Microsoft.PowerShell32
$a = Invoke-Command -Session $session -ScriptBlock ${function:myFunction} -ArgumentList $var1, $var2, $var3

Open in new window

0
 
LVL 2

Author Closing Comment

by:itnifl
ID: 40343795
Thanks, would wish the error message was that specific..
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If we need to check who deleted a Virtual Machine from our vCenter. Looking this task in logs can be painful and spend lot of time, so the best way to check this is in the vCenter DB. Just connect to vCenter DB(default DB should be VCDB and using…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how they can get their files copied out from their unbootable system without need to use recovery services. As an example non-bootable Windows 2012R2 installation is used which has boot problems.
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question