473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Converting from VB? Partial success...



I am attempting to convert the following VB Script code to Python, but
with limited success.

I appear to be connecting fine, but I can't get the registry information
out... I can get the manifest, and I do have the correct permissions
with the user account that I am using...

The VB code works, so it is a issue with the python implementation...
------------------------ VB Code -----------------------------
Const HKEY_CURRENT_USER = &H80000001

Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer("13.1.99.43",
"root\default",
"operator", "spire")
objWMIService.Security_.ImpersonationLevel = 3
set objRegister = objWMIService.get("StdRegProv")

Dim arrValues
strKeyPath = "Software\SCITEX\GUI"
strKey = "Version"
objRegister.GetStringValue HKEY_CURRENT_USER, strKeyPath, strKey, value

Wscript.Echo value
-------------------------------------------------------------------------
-
import _winreg
import win32com.client

HostName = "remote_ip" # local host
login_account = "account name"
account_pass = "password"

strKeyPath = r"\HKEY_LOCAL_MACHINE\SOFTWARe\Microsoft\DrWats on"
strKey = r"AppendToLogFile"

HKLM = 0x80000001L

objLocator = win32com.client.Dispatch ("WbemScripting.SWbemLocator")
print dir(objLocator)
objWMIService = objLocator.ConnectServer (HostName, "root\default",
login_account, account_pass)
objWMIService.Security_.ImpersonationLevel = 3
print dir(objWMIService.__class__)
#
# Dir is showing a "generic" dynamic listing??? Why?
#
#print objWMIService.__doc__
objRegister = objWMIService.Get ("StdRegProv")
test = objRegister.GetObjectText_ ( 1 )
#test2 = objRegister.GetStringValue_ ( "SOFTWARE\Microsoft\DrWatson",
"AppendToLogFile" )
print test2 # Print's the manifest
#print test
Jul 18 '05 #1
0 1164

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: IWP506 | last post by:
I'd like to make a page with a sort of check list as it works. I.e. CHECKING FOR FILE... SUCCESS then a few seconds later it sends OPENING HANDLE... SUCCESS, etc. But since PHP is server-side...
3
by: Stephan Brunner | last post by:
Hi I have created two flavors of an XSLT stylesheet to transform all attributes of an XML document to elements: They both work as expected with MSXML and XMLSPY but throw an exception ...
1
by: Erwin Van de Velde | last post by:
Hi, I'm building a central logging system for security applications as my master thesis, but I've run into some troubles: Different applications make database logs using different formats: -...
3
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the...
0
by: Andrew Ducker | last post by:
VS 2005 uses Partial Classes to keep the designer-generated code separate from the user-created code. Obviously VS 2003 doesn't. However, when converting from 2003 to 2005, it doesn't split the...
2
by: Les Caudle | last post by:
I've inherited a .NET 1.0 app that I'm converting to 2.0. It contains a number of .xsd files (.xsd, .xsx, .cs) which get converted to (.xsd, .xsx, .xss, .xsc, .cs, .Designer.cs). The problem...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
4
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
So I have this problem. I'm currently involved in a team project that has a nightly build on a build server and a continuous integration build on the same server. We want to build our c# program...
1
by: =?Utf-8?B?SG93YXJkIFBpbnNsZXk=?= | last post by:
I'm trying to convert a Web Site to the Web Application project model and I'm running into compile errors that do not seem to be covered by the guidance I found at "Converting a Web Site Project to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.