cancel
Showing results for 
Search instead for 
Did you mean: 

VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Contributor

VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hi everyone,

 

We have just installed HOPEX V1R3, before we were on MEGA 2009 SP5 .

The server is now on Windows SERVER 2012 R2

My old vbscript doesn't work anymore 

If  I run it directly on the server it's OK but if I  run  the same script throw the network, it doesn't work 

 

I 've got  an error when trying to assigned the Current Administrator because MyEnv is null 

 

 Here is my code : 

 

Dim myEnvironment,myAdministrator,myPassword,myRepository

'**************************Entry Points Parameters**********************
myEnvironment = "\\myServer\Mega\Env" 'Path of the environment
myAdministrator = "Administrator" 'Name of the user administrator 
myPassword = "XXXX" 'Password of the user administrator
myRepository = "myRepo" 'Name of the repository

'**************************************************************************

 

Set myApp = CreateObject ("Mega.Application")

 

Set myEnv = myApp.Environments.Item(myEnvironment)

myEnv.CurrentAdministrator = myAdministrator

==> Error Message :  Erreur d'Execution VB Script :  required Object

In fact,  myEnv is null 

If I try to prin My Env before ,  I have  this error  "Object Variable not defined"  

 

(Example :

Set myEnv = Nothing
Set myApp = CreateObject ("Mega.Application")
Set myEnv = myApp.Environments.Item(myEnvironment)
msgbox myEnv  ) 


If myPassword <> "" Then
myEnv.CurrentPassword = myPassword
End If
Set myBase = myEnv.Databases.Item(myRepository)
Set myRoot = myBase.open

 

If someone have an idea , I will be  very happy !

Thanks 

Sandrine

10 REPLIES
vtm
Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hi,

 

Can you try to see what is in the myEnvironment variable ?

 

MsgBox(myEnvironment)

 

It seems that Mega can't find the environnement path stored in this variable.

Highlighted
Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Thanks for your response

When I Print  the object :   MyEnvironment

 

Dim myEnvironment,myAdministrator,myPassword,myRepository
'**************************Entry Points Parameters**********************
myEnvironment   = "\\myServer\Mega\Env\CPageI"
msgbox "myEnvironment:" & myEnvironment & vbNewLine&  "myRepository" & myRepository
Set myEnv = myApp.Environments.Item(myEnvironment)
msgbox  "myEnv:" & myEnv

 

in MyEnvironement, there is  my UNC path  : \\myserver\Mega\Env\myBase

This is a valid path  for everyone with total access

 

The script and the environment are on a machine Number 1

I call the script with a machine Number 2,  with a cmd command window , using the UNC path , it doesn't  work

 

If I call the same script  directly on the machine Numer 1 , it works

vtm
Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Are you sure you can access this UNC Path from Number 2 ? Try opening a file explorer and past the UNC address, see if you can access it.

 

Can you also list the Environments you get from myApp.Enviroments ?

 

For each myEnv in myApp.Environments

   Msgbox (MyEnv.Name & " : " & MyEnv.Path)

Next

MEGA

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hello sgonthey

 

Check that the UNC reference of the environment in megasite.ini is exactly the same as in the administration script

 

Check that you can open the environment in Administration.exe

- from machine 2

-  with the user quoted in the administration script

 

I did a check on my side and it works OK

 

'test in 750CP13 SQL Server
sAdmUser = "Administrator"
sAdmPwd = ""
sEnvPath = "\\W-JHR7\_StandardData\JHR_750_cp13_V1R3_SQLServer"
sRepository= "Test"

'create instance of MEGA/HOPEX
Set oMegaApp = CreateObject("Mega.Application")
Msgbox "Intallation path : " & oMegaApp.Path
Set oEnvironment=oMegaApp.Environments.item(sEnvPath)
'open environment 
oEnvironment.CurrentAdministrator = sAdmUser
oEnvironment.CurrentPassword = sAdmPwd
Msgbox "Environment: " & oEnvironment.Name
'get data repository
Set oDatabase = oEnvironment.Databases.Item(sRepository)
'open root in administrration session mode
Set oRoot = oDatabase.Open
Msgbox oRoot.Name
Set oMegaApp = Nothing
Msgbox "Processing end"

 

 

Jerome
Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hello,

 

Since Windows Server 2008, I avoid using UNC connections in scripts. Accessing some folders or shares is more complicated (or secure) than previously. It is best as possible to use local path (c:\myenvironment) especially with VBS.

Another important point: The windows Account/Profile that launches the script must have the rights to access this server using the UNC path.

 

HDR

Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Thanks a lot for all your responses Smiley Happy
We found a solution but it's not the better one  and it's low-achieving 


The UNC path is accessible from all the machines the main problem is that  the MEGA exe files  are not present  on user's machine anymore,  but only on the server. We just change that.
Users connect to HOPEX  via a TSE connexion.


We want to execute a script from a User Machine ( Machine 2 ) , but using exe files of the server ( machine 1) and it's not possible actually..

 

For the moment, the solution we found, is to call a  schedule task  with a local windows account, on the machine 1 (and with local path ).

With  other softwares ( Like HP Quality Center), it's possible to install  only the dll files used for API.
Do Someone know if it's possible with HOPEX ? It will be the best solution for us !

MEGA

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hello sgonthey

 

I assume you are using MEGA 2009 SP5.

 

To run a program using API script functions on a machine, it is requested that

  • MEGA/HOPEX programs are installed locally
  • Such programs are identified in local registry (performed when installing MEGA/HOPEX from CD/Master)

With MEGA 2009 SP5, you could also consider a remote execution

  • MEGA/HOPEX programs are installed on a network disk (remote programs)
  • Such programs are identified in local registry (performed by command such has xx\mgwmapp /regerver)

Performances can be slow. Security issues can occur (more and more).

This deployment is no longer supported with HOPEX versions.

Jerome
Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

 

We've  just upgrade our  MEGA 2009 SP5, we work now with HOPEX  V1R3 CP13

Previously, MEGA was locally installed on each machine

Now, only one Machine is installed with Hopex.It's better for response time, and easier for administration, but there is other problems like that. 

 

Thanks

Contributor

Re: VB script Error ( API) with Server 2012 R2 and HOPEX V1R3

Hi,

 

The connection using API starting in HOPEX is different, you have to provide the user's profil. I mean the Business Role or affectation.

 

My connection sequence :

 

' MEGA Connection
'-----------------------
Set oMegaRoot = Nothing

 

'Setting credentials
'-------------------------
StrBDD = "MyWorkspace"
strUser = "MyUSer"
strpass = "MyUserPassword"
strProf = "Mega Customizer"

 

'init MEGA Object
'----------------------------
strPathEnv = "\\Path_to_referential"


Set MegaEnv = MegaSite.Environments.Item(strPathEnv)

MegaEnv.CurrentAdministrator = strUser
MegaEnv.CurrentPassword = strpass
MegaEnv.CurrentProfile=strProf

 

set myTransaction = MegaEnv.Transactions.create(StrBDD, strUser)
set oMegaRoot = myTransaction.Database.Open