#212076 - 2016-11-04 12:06 PM
Re: Issue with COM and Server 2008
[Re: Allen]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
Same error whether Clear or Tokenized. I use KGen to create and tokenize the script. It always creates a clear-text .GEN file before tokenizing. Whenever I have to troubleshoot, I use the .GEN file. Any changes I make there are replicated to the original source if they resolve the problem. Yesterday, I decided to copy the raw code from Kix-O-Matic to enumerate disk volumes and was surprised to see it work flawlessly. I had used a snippet of that in my code, and aside from the var names, the code was identical but didn't work.
The weird part is that my code had Dim and Global statements, the SetOption functions, some variable definition/initializations, and then the GetObject instantiation, which failed with Invalid Syntax. The K-O-M code had no variable declarations or SetOption statements, so it had to be something there. The variable definition block did get a value from the registry and two from an INI file, but no issues with that, so I started commenting out the SetOption values.
For this project - about 45 Kix and KF apps - I use a standard header structure, standardized var names, and the same SetOption settings in all. In fact, except for unique variable declarations and definitions, the first 120 lines of every applet have the same code to load common settings from reg and INI, and perform a licensing check. Only a small handful of utility scripts don't include the licensing check.
At this point, I'm modifying the header of every app to set the affected SetOption setting to "on". In the few apps that require the setting, I've inserted SetOtion statements to turn the value off when needed and then back on. It's a PITA to adjust the code, but at least the 2K8 platforms will be supported again.
I'm posting here as it clearly needs to be tested or at least be documented. That SetOption value might have been introduced after 2K8 was already deployed and didn't get much testing early on.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#212080 - 2016-11-04 10:16 PM
Re: Issue with COM and Server 2008
[Re: Glenn Barnas]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4548
Loc: USA
|
Confirmed on Server 2008. My notes...
Happening at least since kix 4.61. After using SetOption("WOW64FileRedirection","Off") - GetObject is broke with error "Invalid Syntax" - Createobject works GetObject works fine as long as WOW64FileRedirection is ON. In fact, if you use GetObject first, and then set WOW64FileRedirection to OFF, it works as expected. You can even recreate the object. New Getobjects however suffer the same "Invalid Syntax"
? @kix
? @producttype
? @onwow64
?
Dim $Rc, $0WMIService, $nul
? "Create Object"
$oWMIService = GetObject("winmgmts:\\.\root\cimv2")
? @SERROR
? vartypename($oWMIService)
?
? "Delete Object"
$oWMIService = $nul
? vartypename($oWMIService)
?
? "File Redirection:" + SetOption("WOW64FileRedirection")
$Rc = SetOption("WOW64FileRedirection","Off")
? @serror
? "File Redirection:" + SetOption("WOW64FileRedirection")
? "Create Object"
$oWMIService = getObject("winmgmts:\\.\root\cimv2")
? @SERROR
4.61
Windows Server 2008
1
Create Object
The operation completed successfully.
Object
Delete Object
Empty
File Redirection:ON
The operation completed successfully.
File Redirection:OFF
Create Object
The operation completed successfully.
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 312 anonymous users online.
|
|
|