Alternate Credentail

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • delwar66
    New Member
    • Nov 2006
    • 14

    #1

    Alternate Credentail

    Hi
    Is anyone here who can help me to get this scripts running under alternate credentials.... .............
    Code:
    '''''''''''''''''''''''''''
    
    '''''''''''''''''''''''''''
    ' Monitor EDID Information'
    strComputer  = Trim(inputbox("Enter name or IP address of local or remote computer"))
    Dim oDisplaySubKeys : Set oDisplaySubKeys = CreateObject("Scripting.Dictionary")
    Dim oRawEDID : Set oRawEDID = CreateObject("Scripting.Dictionary")
    Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
    
    Int intMonitorCount=0
    Int intDisplaySubKeysCount=0
    Int i=0
    
    Set oRegistry = GetObject("winmgmts:\\" & strComputer & "/root/default:StdRegProv")
    strDisplayBaseKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY\"
    
    ' Retrieving EISA-Id from HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY and storing in strarrDisplaySubKeys
    iRC = oRegistry.EnumKey(HKLM, strDisplayBaseKey, strarrDisplaySubKeys)
    
    ' Deleting from strarrDisplaySubKeys "Default_Monitor" value
    For Each sKey In strarrDisplaySubKeys
    
    If sKey ="Default_Monitor" Then
    intDisplaySubKeysCount=intDisplaySubKeysCount - 1
    Else
    oDisplaySubKeys.add sKey, intDisplaySubKeysCount
    End If
    
    intDisplaySubKeysCount=intDisplaySubKeysCount + 1
    
    Next
    
    ' Storing result in oDisplaySubKeys
    strResultDisplaySubKeys=oDisplaySubKeys.Keys
    
    toto=0
    
    For i = 0 to oDisplaySubKeys.Count -1
    
    strEisaIdBaseKey = strDisplayBaseKey & strResultDisplaySubKeys(i) & "\"
    
    ' Retrieving Pnp-Id from HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY\EISA-Id and storing in strarrEisaIdSubKeys
    iRC2 = oRegistry.EnumKey(HKLM, strEisaIdBaseKey, strarrEisaIdSubKeys)
    
    For Each sKey2 In strarrEisaIdSubKeys
    oRegistry.GetMultiStringValue HKLM, strEisaIdBaseKey & sKey2 & "\", "HardwareID", sValue
    
    For tmpctr=0 to ubound(svalue)
    
    If lcase(Left(svalue(tmpctr),8))="monitor\" then
    
    strMsIdBaseKey = strEisaIdBaseKey & sKey2 & "\"
    
    iRC3 = oRegistry.EnumKey(HKLM, strMsIdBaseKey, strarrMsIdSubKeys)
    
    For Each sKey3 In strarrMsIdSubKeys
    
    If skey3="Control" then
    
    toto=toto + 1
    
    oRegistry.GetBinaryValue HKLM, strMsIdBaseKey & "Device Parameters\", "EDID", intarrEDID
    
    strRawEDID=""
    strRawEDIDb=""
    
    If vartype(intarrEDID) = 8204 then
    
    For each strByteValue in intarrEDID
    
    strRawEDID=strRawEDID & Chr(strByteValue)
    strRawEDIDb=strRawEDIDb & Chr(strByteValue)
    
    Next
    
    Else
    
    strRawEDID="EDID Not Available"
    
    End If
    
    
    oRawEDID.add intMonitorCount , strRawEDID
    intMonitorCount=intMonitorCount + 1
    
    End If
    Next
    End If
    Next
    Next
    Next
    
    
    
    'now the EDID info For each active monitor is stored in an dictionnary of strings called oRawEDID
    'so we can process it to get the good stuff out of it which we will store in a 5 dimensional array
    'called arrMonitorInfo, the dimensions are as follows:
    '0=VESA Mfg ID, 1=VESA Device ID, 2=MFG Date (M/YYYY),3=Serial Num (If available),4=Model Descriptor
    
    
    strResultRawEDID=oRawEDID.Keys
    
    dim arrMonitorInfo()
    redim arrMonitorInfo(intMonitorCount-1,5)
    dim location(3)
    
    
    
    For i=0 to oRawEDID.Count - 1
    
    If oRawEDID(i) <> "EDID Not Available" then
    
    
    
    location(0)=mid(oRawEDID(i),&H36+1,18)
    location(1)=mid(oRawEDID(i),&H48+1,18)
    location(2)=mid(oRawEDID(i),&H5a+1,18)
    location(3)=mid(oRawEDID(i),&H6c+1,18)
    
    
    strSerFind=Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&Hff)
    
    
    strMdlFind=Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&Hfc)
    
    intSerFoundAt=-1
    intMdlFoundAt=-1
    
    For findit = 0 to 3
    If instr(location(findit),strSerFind)>0 then
    
    intSerFoundAt=findit
    
    End If
    
    If instr(location(findit),strMdlFind)>0 then
    
    intMdlFoundAt=findit
    
    End If
    
    Next
    
    'If a location containing a serial number block was found then store it
    If intSerFoundAt<>-1 then
    
    tmp=Right(location(intSerFoundAt),14)
    
    If instr(tmp,Chr(&H0a))>0 then
    
    tmpser=Trim(Left(tmp,instr(tmp,Chr(&H0a))-1))
    
    Else
    
    tmpser=Trim(tmp)
    
    End If
    
    
    If Left(tmpser,1)=Chr(0) then tmpser=Right(tmpser,Len(tmpser)-1)
    
    Else
    
    tmpser="Serial Number Not Found in EDID data"
    
    End If
    
    'If a location containing a model number block was found then store it
    If intMdlFoundAt<>-1 then
    
    tmp=Right(location(intMdlFoundAt),14)
    
    If instr(tmp,Chr(&H0a))>0 then
    
    tmpmdl=Trim(Left(tmp,instr(tmp,Chr(&H0a))-1))
    
    Else
    
    tmpmdl=Trim(tmp)
    
    End If
    
    
    If Left(tmpmdl,1)=Chr(0) then tmpmdl=Right(tmpmdl,Len(tmpmdl)-1)
    
    Else
    
    tmpmdl="Model Descriptor Not Found in EDID data"
    
    End If
    
    tmpmfgweek=Asc(mid(oRawEDID(i),&H10+1,1))
    
    
    tmpmfgyear=(Asc(mid(oRawEDID(i),&H11+1,1)))+1990
    
    
    tmpmdt=month(dateadd("ww",tmpmfgweek,DateValue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear
    
    
    tmpEDIDMajorVer=Asc(mid(oRawEDID(i),&H12+1,1))
    
    tmpEDIDRev=Asc(mid(oRawEDID(i),&H13+1,1))
    
    
    If tmpEDIDMajorVer < 255-48 and tmpEDIDRev < 255-48 Then
    
    tmpver=Chr(48+tmpEDIDMajorVer) & "." & Chr(48+tmpEDIDRev)
    
    Else
    tmpver="Not available"
    
    End If
    
    
    tmpEDIDMfg=mid(oRawEDID(i),&H08+1,2)
    
    Char1=0 : Char2=0 : Char3=0
    
    Byte1=Asc(Left(tmpEDIDMfg,1)) 'get the first half of the string
    Byte2=Asc(Right(tmpEDIDMfg,1)) 'get the first half of the string
    
    
    If (Byte1 and 64) > 0 then Char1=Char1+16
    
    If (Byte1 and 32) > 0 then Char1=Char1+8
    
    If (Byte1 and 16) > 0 then Char1=Char1+4
    If (Byte1 and 8) > 0 then Char1=Char1+2
    If (Byte1 and 4) > 0 then Char1=Char1+1
    
    
    If (Byte1 and 2) > 0 then Char2=Char2+16
    If (Byte1 and 1) > 0 then Char2=Char2+8
    
    
    If (Byte2 and 128) > 0 then Char2=Char2+4
    If (Byte2 and 64) > 0 then Char2=Char2+2
    If (Byte2 and 32) > 0 then Char2=Char2+1
    
    
    Char3=Char3+(Byte2 and 16)
    Char3=Char3+(Byte2 and 8)
    Char3=Char3+(Byte2 and 4)
    Char3=Char3+(Byte2 and 2)
    Char3=Char3+(Byte2 and 1)
    
    tmpmfg=Chr(Char1+64) & Chr(Char2+64) & Chr(Char3+64)
    
    tmpEDIDDev1=hex(Asc(mid(oRawEDID(i),&H0a+1,1)))
    tmpEDIDDev2=hex(Asc(mid(oRawEDID(i),&H0b+1,1)))
    
    If Len(tmpEDIDDev1)=1 then tmpEDIDDev1="0" & tmpEDIDDev1
    If Len(tmpEDIDDev2)=1 then tmpEDIDDev2="0" & tmpEDIDDev2
    
    tmpdev=tmpEDIDDev2 & tmpEDIDDev1
    
    
    arrMonitorInfo(i,0)=tmpmfg
    arrMonitorInfo(i,1)=tmpdev
    arrMonitorInfo(i,2)=tmpmdt
    arrMonitorInfo(i,3)=tmpser
    arrMonitorInfo(i,4)=tmpmdl
    arrMonitorInfo(i,5)=tmpver
    End If
    
    wscript.echo "Monitor " & Chr(i+65) & ")" & VbCrLF & _
    "VESA Manufacturer ID= " & arrMonitorInfo(i,0) & VbCrLF & _
     "Manufacture Date= " & arrMonitorInfo(i,2) & VbCrLF & _
     "Serial Number= " & arrMonitorInfo(i,3) & VbCrLF & _
     "Model Name= " & arrMonitorInfo(i,4)
    
    Next
    
    
    
    Function ErrorCheck(strErrorNumber)
        Select Case strErrorNumber
            Case "-2147024843"
                ErrorCheck =  strError_ComputerNotFound
            Case "-2147023518"
                ErrorCheck = strError_AlreadyAdmin
            Case "-2147023509"
                ErrorCheck = strError_UserNotFound
        End Select
    End Function
    
    Function Pingable(strComputer)
    Dim objShell
    Dim strTemp
    Dim objFSO
    Dim iReturn
    Dim objTextFile
    Pingable = False
    Set objShell = CreateObject("WScript.Shell")
    strTemp = objShell.ExpandEnvironmentStrings("%temp%") & _
     "/tempping.txt"
    iReturn = objShell.Run("%comspec% /C ping " & strComputer & _
             " -n 1 > " & strTemp, 0, True)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile(strTemp, 1)
    While Not objTextFile.AtEndOfStream
        If InStr(objTextFile.ReadLine, "Reply") Then Pingable = True
    Wend
    objTextFile.Close
    objFSO.DeleteFile (strTemp)
    End Function
  • delwar66
    New Member
    • Nov 2006
    • 14

    #2
    Hi Guys
    Finally I have figured it out so, pls don't bother.

    Thanks

    Comment

    Working...