Solved

VBScript - encrypt a password based off computer name

Posted on 2006-07-24
2
2,101 Views
Last Modified: 2012-05-05
I've tried using some of the posted encryption functions on here, but can't seem to get them to do what I'm looking for exactly.

I'm looking for a VBScript that I can run via GPO or some other means that will set the local Administrator password. I am fine with the part of the script that will set the password, all I need is an encryption function that I can pass 2 variables: the local computer name, and a static string. The function needs to take those 2 strings and create a cryptic password. On any given computer, since the computer name will not change and neither will the string, the function will return the same password every time, unless the computer name changes. This will make sure each machine has a unique password.

The funtion I'm using now works, but generates a lot of different ASCII characters, so most of them can't be typed out easily on the keyboard.

Does anyone out there have any basic fucntions that might help me out.

Thanks
0
Comment
Question by:AGCIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Expert Comment

by:jmundsack
ID: 17168523
You could encode the computer name and static string using Base64, which consists of only printable characters.

Check out these links:

Encode to Base64:
http://www.motobit.com/tips/detpg_Base64Encode/

Decode from Base64:
http://www.motobit.com/tips/detpg_Base64/

HTH-Jon
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 17169331

try this:

option explicit

MsgBox (encodeString("My Computer", "static string"))



Function encodeString(str1 , str2 )
Const cStrA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Dim StrB,tmpStr,n,j
    StrB = "0987654321QWERTYUIOPLKJHGFDSAZXCVBNMmnbvcxzasdfghjklpoiuytrewq"
   tmpStr = str1 & str2
   encodeString = ""
For n = 1 To Len(tmpStr) - 1
   j = InStr(cStrA, Mid(tmpStr, n, 1))
   If j > 0 Then
      encodeString = encodeString & Mid(StrB, j, 1)
      StrB = Right(StrB, Len(StrB) - 1) & Left(StrB, 1)
   End If
Next
End Function
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question