asked on
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
StrComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName"
strValueName = "ComputerName"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
dim strComputer
dim strKeyPath
dim strValue
dim strValueName
dim strPassword
dim objReg
strComputer = "."
strKeyPath = "SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName"
strValueName = "ComputerName"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strPassword = "Pass" & right("XXXX" & 2*mid(strValue,len(strValue)-3,4),4)
WScript.Echo strValue & " --> " & strPassWord
Regards,dim strComputer
strComputer = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%COMPUTERNAME%")
on error resume next
strComputerName=CreateObject("WScript.Shell").Environment("PROCESS")("COMPUTERNAME")
'Remove this next line after checking oK
strComputerName=inputbox("Please check and amend computer name to test with",,strComputerName)
if strComputerName="" then wscript.quit
strPassword = "Pass" & right("XXXX" & 2*right(strComputerName,4),4)
if strPassword="" then
Msgbox "Error finding password for " & strComputerName
else
msgbox "Password is: " & strPassword,,strComputerName
End if
ASKER
ASKER
ASKER
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.
TRUSTED BY
I don't know vbScript but you should be able to convert
strvalue = Right(strValue,4)
strValue = "Pass" & Right("XXXX" & ToText(val(strValue) * 2),4)
mlmcc