Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 23 MAY 2013 07:29:34PM Barry Stevens wrote:

What are the ways to tell if OI is running from a server or standalone PC (NOT Drive letter). Using same folder name.

Running UD 4.7 OI 9.3.2


At 23 MAY 2013 10:41PM Bob Carten wrote:

Hi Barry,

You can use a WMI query to determine the role of the computer.

That will tell you if you are running from a server or a workstation.

Is that what you are trying to do?


Function rti_GetWindowsRole(void)

/*

** Use WMI to get windows version

** http://technet.microsoft.com/en-us/library/ee198796.aspx

** 05-23-13  rjc translated into Basic+

*/



declare function rti_Ole_GetObject, get_machine_name

strComputer = "."; *get_machine_name()

moniker =  "winmgmts:"

moniker := "{impersonationLevel=impersonate,authenticationLevel=Pkt}"

moniker := "!\\"

moniker := strComputer : "\root\cimv2"

objWMIService = Rti_Ole_GetObject(moniker)



colItems = objWMIService->ExecQuery("SELECT * FROM Win32_ComputerSystem")

cnt = colItems->Count

test = colItems->GetIterator()

strRole = ''

for i = 1 to cnt

	objComputer = OleCallMethod(colItems,'ItemIndex', i-1) ; * ItemIndex may not work on XP

	roleNum = objComputer->DomainRole	

	Begin Case			

		Case  roleNum = 0 ;strRole = "Standalone Workstation"

		Case  roleNum = 1 ;strRole = "Member Workstation"

		Case  roleNum = 2 ;strRole = "Standalone Server"

		Case  roleNum = 3 ;strRole = "Member Server"

		Case  roleNum = 4 ;strRole = "Backup Domain Controller"

		Case  roleNum = 5 ;strRole = "Primary Domain Controller"			

	end case

While strRole = ''

Next

return strRole




At 24 MAY 2013 01:33AM Barry Stevens wrote:

Thanks Bob, that looks like what I am after.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/058014c50479016160de0942c.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1