473,396 Members | 2,004 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.

Alternate Credentail

Hi
Is anyone here who can help me to get this scripts running under alternate credentials.................
Expand|Select|Wrap|Line Numbers
  1.  
  2. '''''''''''''''''''''''''''
  3.  
  4. '''''''''''''''''''''''''''
  5. ' Monitor EDID Information'
  6. strComputer  = Trim(inputbox("Enter name or IP address of local or remote computer"))
  7. Dim oDisplaySubKeys : Set oDisplaySubKeys = CreateObject("Scripting.Dictionary")
  8. Dim oRawEDID : Set oRawEDID = CreateObject("Scripting.Dictionary")
  9. Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
  10.  
  11. Int intMonitorCount=0
  12. Int intDisplaySubKeysCount=0
  13. Int i=0
  14.  
  15. Set oRegistry = GetObject("winmgmts:\\" & strComputer & "/root/default:StdRegProv")
  16. strDisplayBaseKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY\"
  17.  
  18. ' Retrieving EISA-Id from HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY and storing in strarrDisplaySubKeys
  19. iRC = oRegistry.EnumKey(HKLM, strDisplayBaseKey, strarrDisplaySubKeys)
  20.  
  21. ' Deleting from strarrDisplaySubKeys "Default_Monitor" value
  22. For Each sKey In strarrDisplaySubKeys
  23.  
  24. If sKey ="Default_Monitor" Then
  25. intDisplaySubKeysCount=intDisplaySubKeysCount - 1
  26. Else
  27. oDisplaySubKeys.add sKey, intDisplaySubKeysCount
  28. End If
  29.  
  30. intDisplaySubKeysCount=intDisplaySubKeysCount + 1
  31.  
  32. Next
  33.  
  34. ' Storing result in oDisplaySubKeys
  35. strResultDisplaySubKeys=oDisplaySubKeys.Keys
  36.  
  37. toto=0
  38.  
  39. For i = 0 to oDisplaySubKeys.Count -1
  40.  
  41. strEisaIdBaseKey = strDisplayBaseKey & strResultDisplaySubKeys(i) & "\"
  42.  
  43. ' Retrieving Pnp-Id from HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY\EISA-Id and storing in strarrEisaIdSubKeys
  44. iRC2 = oRegistry.EnumKey(HKLM, strEisaIdBaseKey, strarrEisaIdSubKeys)
  45.  
  46. For Each sKey2 In strarrEisaIdSubKeys
  47. oRegistry.GetMultiStringValue HKLM, strEisaIdBaseKey & sKey2 & "\", "HardwareID", sValue
  48.  
  49. For tmpctr=0 to ubound(svalue)
  50.  
  51. If lcase(Left(svalue(tmpctr),8))="monitor\" then
  52.  
  53. strMsIdBaseKey = strEisaIdBaseKey & sKey2 & "\"
  54.  
  55. iRC3 = oRegistry.EnumKey(HKLM, strMsIdBaseKey, strarrMsIdSubKeys)
  56.  
  57. For Each sKey3 In strarrMsIdSubKeys
  58.  
  59. If skey3="Control" then
  60.  
  61. toto=toto + 1
  62.  
  63. oRegistry.GetBinaryValue HKLM, strMsIdBaseKey & "Device Parameters\", "EDID", intarrEDID
  64.  
  65. strRawEDID=""
  66. strRawEDIDb=""
  67.  
  68. If vartype(intarrEDID) = 8204 then
  69.  
  70. For each strByteValue in intarrEDID
  71.  
  72. strRawEDID=strRawEDID & Chr(strByteValue)
  73. strRawEDIDb=strRawEDIDb & Chr(strByteValue)
  74.  
  75. Next
  76.  
  77. Else
  78.  
  79. strRawEDID="EDID Not Available"
  80.  
  81. End If
  82.  
  83.  
  84. oRawEDID.add intMonitorCount , strRawEDID
  85. intMonitorCount=intMonitorCount + 1
  86.  
  87. End If
  88. Next
  89. End If
  90. Next
  91. Next
  92. Next
  93.  
  94.  
  95.  
  96. 'now the EDID info For each active monitor is stored in an dictionnary of strings called oRawEDID
  97. 'so we can process it to get the good stuff out of it which we will store in a 5 dimensional array
  98. 'called arrMonitorInfo, the dimensions are as follows:
  99. '0=VESA Mfg ID, 1=VESA Device ID, 2=MFG Date (M/YYYY),3=Serial Num (If available),4=Model Descriptor
  100.  
  101.  
  102. strResultRawEDID=oRawEDID.Keys
  103.  
  104. dim arrMonitorInfo()
  105. redim arrMonitorInfo(intMonitorCount-1,5)
  106. dim location(3)
  107.  
  108.  
  109.  
  110. For i=0 to oRawEDID.Count - 1
  111.  
  112. If oRawEDID(i) <> "EDID Not Available" then
  113.  
  114.  
  115.  
  116. location(0)=mid(oRawEDID(i),&H36+1,18)
  117. location(1)=mid(oRawEDID(i),&H48+1,18)
  118. location(2)=mid(oRawEDID(i),&H5a+1,18)
  119. location(3)=mid(oRawEDID(i),&H6c+1,18)
  120.  
  121.  
  122. strSerFind=Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&Hff)
  123.  
  124.  
  125. strMdlFind=Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&Hfc)
  126.  
  127. intSerFoundAt=-1
  128. intMdlFoundAt=-1
  129.  
  130. For findit = 0 to 3
  131. If instr(location(findit),strSerFind)>0 then
  132.  
  133. intSerFoundAt=findit
  134.  
  135. End If
  136.  
  137. If instr(location(findit),strMdlFind)>0 then
  138.  
  139. intMdlFoundAt=findit
  140.  
  141. End If
  142.  
  143. Next
  144.  
  145. 'If a location containing a serial number block was found then store it
  146. If intSerFoundAt<>-1 then
  147.  
  148. tmp=Right(location(intSerFoundAt),14)
  149.  
  150. If instr(tmp,Chr(&H0a))>0 then
  151.  
  152. tmpser=Trim(Left(tmp,instr(tmp,Chr(&H0a))-1))
  153.  
  154. Else
  155.  
  156. tmpser=Trim(tmp)
  157.  
  158. End If
  159.  
  160.  
  161. If Left(tmpser,1)=Chr(0) then tmpser=Right(tmpser,Len(tmpser)-1)
  162.  
  163. Else
  164.  
  165. tmpser="Serial Number Not Found in EDID data"
  166.  
  167. End If
  168.  
  169. 'If a location containing a model number block was found then store it
  170. If intMdlFoundAt<>-1 then
  171.  
  172. tmp=Right(location(intMdlFoundAt),14)
  173.  
  174. If instr(tmp,Chr(&H0a))>0 then
  175.  
  176. tmpmdl=Trim(Left(tmp,instr(tmp,Chr(&H0a))-1))
  177.  
  178. Else
  179.  
  180. tmpmdl=Trim(tmp)
  181.  
  182. End If
  183.  
  184.  
  185. If Left(tmpmdl,1)=Chr(0) then tmpmdl=Right(tmpmdl,Len(tmpmdl)-1)
  186.  
  187. Else
  188.  
  189. tmpmdl="Model Descriptor Not Found in EDID data"
  190.  
  191. End If
  192.  
  193. tmpmfgweek=Asc(mid(oRawEDID(i),&H10+1,1))
  194.  
  195.  
  196. tmpmfgyear=(Asc(mid(oRawEDID(i),&H11+1,1)))+1990
  197.  
  198.  
  199. tmpmdt=month(dateadd("ww",tmpmfgweek,DateValue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear
  200.  
  201.  
  202. tmpEDIDMajorVer=Asc(mid(oRawEDID(i),&H12+1,1))
  203.  
  204. tmpEDIDRev=Asc(mid(oRawEDID(i),&H13+1,1))
  205.  
  206.  
  207. If tmpEDIDMajorVer < 255-48 and tmpEDIDRev < 255-48 Then
  208.  
  209. tmpver=Chr(48+tmpEDIDMajorVer) & "." & Chr(48+tmpEDIDRev)
  210.  
  211. Else
  212. tmpver="Not available"
  213.  
  214. End If
  215.  
  216.  
  217. tmpEDIDMfg=mid(oRawEDID(i),&H08+1,2)
  218.  
  219. Char1=0 : Char2=0 : Char3=0
  220.  
  221. Byte1=Asc(Left(tmpEDIDMfg,1)) 'get the first half of the string
  222. Byte2=Asc(Right(tmpEDIDMfg,1)) 'get the first half of the string
  223.  
  224.  
  225. If (Byte1 and 64) > 0 then Char1=Char1+16
  226.  
  227. If (Byte1 and 32) > 0 then Char1=Char1+8
  228.  
  229. If (Byte1 and 16) > 0 then Char1=Char1+4
  230. If (Byte1 and 8) > 0 then Char1=Char1+2
  231. If (Byte1 and 4) > 0 then Char1=Char1+1
  232.  
  233.  
  234. If (Byte1 and 2) > 0 then Char2=Char2+16
  235. If (Byte1 and 1) > 0 then Char2=Char2+8
  236.  
  237.  
  238. If (Byte2 and 128) > 0 then Char2=Char2+4
  239. If (Byte2 and 64) > 0 then Char2=Char2+2
  240. If (Byte2 and 32) > 0 then Char2=Char2+1
  241.  
  242.  
  243. Char3=Char3+(Byte2 and 16)
  244. Char3=Char3+(Byte2 and 8)
  245. Char3=Char3+(Byte2 and 4)
  246. Char3=Char3+(Byte2 and 2)
  247. Char3=Char3+(Byte2 and 1)
  248.  
  249. tmpmfg=Chr(Char1+64) & Chr(Char2+64) & Chr(Char3+64)
  250.  
  251. tmpEDIDDev1=hex(Asc(mid(oRawEDID(i),&H0a+1,1)))
  252. tmpEDIDDev2=hex(Asc(mid(oRawEDID(i),&H0b+1,1)))
  253.  
  254. If Len(tmpEDIDDev1)=1 then tmpEDIDDev1="0" & tmpEDIDDev1
  255. If Len(tmpEDIDDev2)=1 then tmpEDIDDev2="0" & tmpEDIDDev2
  256.  
  257. tmpdev=tmpEDIDDev2 & tmpEDIDDev1
  258.  
  259.  
  260. arrMonitorInfo(i,0)=tmpmfg
  261. arrMonitorInfo(i,1)=tmpdev
  262. arrMonitorInfo(i,2)=tmpmdt
  263. arrMonitorInfo(i,3)=tmpser
  264. arrMonitorInfo(i,4)=tmpmdl
  265. arrMonitorInfo(i,5)=tmpver
  266. End If
  267.  
  268. wscript.echo "Monitor " & Chr(i+65) & ")" & VbCrLF & _
  269. "VESA Manufacturer ID= " & arrMonitorInfo(i,0) & VbCrLF & _
  270.  "Manufacture Date= " & arrMonitorInfo(i,2) & VbCrLF & _
  271.  "Serial Number= " & arrMonitorInfo(i,3) & VbCrLF & _
  272.  "Model Name= " & arrMonitorInfo(i,4)
  273.  
  274. Next
  275.  
  276.  
  277.  
  278. Function ErrorCheck(strErrorNumber)
  279.     Select Case strErrorNumber
  280.         Case "-2147024843"
  281.             ErrorCheck =  strError_ComputerNotFound
  282.         Case "-2147023518"
  283.             ErrorCheck = strError_AlreadyAdmin
  284.         Case "-2147023509"
  285.             ErrorCheck = strError_UserNotFound
  286.     End Select
  287. End Function
  288.  
  289. Function Pingable(strComputer)
  290. Dim objShell
  291. Dim strTemp
  292. Dim objFSO
  293. Dim iReturn
  294. Dim objTextFile
  295. Pingable = False
  296. Set objShell = CreateObject("WScript.Shell")
  297. strTemp = objShell.ExpandEnvironmentStrings("%temp%") & _
  298.  "/tempping.txt"
  299. iReturn = objShell.Run("%comspec% /C ping " & strComputer & _
  300.          " -n 1 > " & strTemp, 0, True)
  301. Set objFSO = CreateObject("Scripting.FileSystemObject")
  302. Set objTextFile = objFSO.OpenTextFile(strTemp, 1)
  303. While Not objTextFile.AtEndOfStream
  304.     If InStr(objTextFile.ReadLine, "Reply") Then Pingable = True
  305. Wend
  306. objTextFile.Close
  307. objFSO.DeleteFile (strTemp)
  308. End Function
  309.  
Nov 14 '06 #1
1 1824
Hi Guys
Finally I have figured it out so, pls don't bother.

Thanks
Nov 14 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Toby A Inkster | last post by:
www.authoring.stylesheets] For ages I have provided links to alternate stylesheets from my pages as per W3C recommendations: <link rel="stylesheet" href="baz" type="text/css" title="Baz"...
5
by: User | last post by:
If I want to provide alternate stylesheets (eg red.css, green.css), is it better to put all the stuff that is common to both sheets in a separate css file (eg basic.css) and use @import at the top...
1
by: Carl Draus | last post by:
I was reading the FixPackReadme.txt file in preparation for installing v8.1 Alternate FP7. The prerequisites section says that all DB2 processes must be stopped and doesn't differentiate between...
0
by: Jean-Marc Blaise | last post by:
Hi, From version 8.1.2 one can install alternate fixpacks on Unix/Linux. What is the IBM policy on alternate fixpack; is it for temporary testing or can it be permanent in Production ? If I...
4
by: Mark A | last post by:
Trying to upgrade alternate FP9 to alternate FP9a on Red Hat Linux. After running the following command: ../installAltFixPak -y it says it was successful, but no new directory is created in...
1
by: Eric Lindsay | last post by:
I am trying to understand the differences between and uses of persistent, default and alternate styles. I have read http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on...
5
by: Michael R | last post by:
Searching the net I've found a simple technique to add row numbers and alternate colors (for the even and the uneven row) to a continuous form. 1st step: Create a textbox, send it to background...
9
by: johkar | last post by:
I need some browser implementation clarification. In the below example, the alternate stylesheet could be invoked by user agents that support alternate stylesheets or by script. Are there any...
0
by: zgh1970 | last post by:
Hi, All, I have some question on the alternate server for the DB connection on db2 connect server. There is one db2 connection to one host database on the server with the following cfg: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.