Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

32 bit com from 64 bit PS Environment

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
i have a ps script which is running as a 64 bit process. this script needs to read some information from a 32 bit only COM object, Microsoft.SMS.Client.
At the momment i am shelling out to a vbscript launched from syswow64 which writes to the registry the information i wanted from Microsoft.SMS.Client, which i then read in again from the 64bit.

I want to clean this mess up. I saw a couple of google hits about...

Invoke-Command server64 { new-object -com "32BitOnlyComProgId" } -ConfigurationName Microsoft.PowerShell32

i have tried the Invoke-Command %computername% but it gave an error, and i still not sure i can access the instance of the COm object from the 64 bit session.

Does anyone have any experience with this type of thing and can give me a few pointers?
 
ive tried using

#this doesnt work
start-job -scriptblock {New-ItemProperty -path "HKLM:\Software\Nestle\Computer" -name "SCCM_AssignedSite" -value (New-Object -comobject Microsoft.SMS.Client).GetCurrentManagementPoint().ToString() -propertyType string} -RunAs32


#this does work
start-job -scriptblock {New-ItemProperty -path "HKLM:\Software\Nestle\Computer" -name "SCCM_AssignedSite" -value "hellow rold" -propertyType string} -RunAs32

from powershell32 command prompt the commands to access Microsoft.SMS.Client all work ok
 
i got bored in the end and google;d how to get the specific info i wanted through other means, namely through WMI (please excuse lack of error handling)

$colResources = Get-WMIObject -namespace "ROOT\CCM" -class "SMS_Authority" | Select-Object CurrentManagementPoint
ForEach($objResource In $colResources){
$strSCCMServer.Value = $objResource.CurrentManagementPoint
}
$strSCCMSite.Value = "Site_" + (Get-ItemProperty -path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\SMS\Mobile Client").AssignedSiteCode

im off home now, please dont bust a gutt, but any info on starting 32bit stuff from 64bit ps would be of interest
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top