I tried out the code myself and it took a little trial and error to make me understand which folder was the source and which was the target. I modified it as shown below to help others.
SourceFolder ="P:\UTILS"
TargetFolder = "C:\DATA\"
Set objShell =...
Here's the code to add the "Command Prompt Here" to the right-click menu. Hope this helps get you started... at least with the part about adding it to the menu.
Set objShell = CreateObject("WScript.Shell")
objShell.RegWrite "HKCR\Folder\Shell\MenuText\Command\"...
This should do it for you as long as the format is exactly as you described including the parentheses. If the parentheses don't exist, you don't need to the second GageNumber assignment (line right above the Wscript.echo). If the space in front of the "B" doesn't exist either, you'll...
Here's some code similar to the VB "Open/Print/Close" method but in VBScript. As you can see, it accepts a UNC to the print server's share. It prints unformatted text just like a DOS PRINT. I've used the concept to print mailing labels from an HTML Application (HTA) that accesses an...
A suggestion that might help you in the future is to use JScript instead of VBScript (blasphemy in a VBScript forum!) You may find it's more akin to C++ in its syntax and ASP pages shouldn't care if you set it up right. I'm more familiar with VB but I've been known to add a little JScript in...
Depends I guess on what you want to print and to where.
I wrote a script that prints mailing labels by writing to a local LPT port using the FileSystemObject. Relative excerpts follow:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objPrinter =...
Depending on where you put the info in AD would depend on where it is (sometimes), but generally:
givenName = First Name
initials = Middle Initial
sn = Last Name (or surname, thus the sn)
This snippet from the sample I referenced above is the key to your request to use the real name to find...
I'm baa-aack!
Actually we "borrowed" the code from Bill Gates. See:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/ScriptCenter/user/ScrUG145.asp
Titled: "Searching for a User Account in Active Directory"
Found in Technet,Script Center,Users and Groups.
I'm just getting into VBS and ADSI myself, but I've got a couple of observations/hints for you.
1) I don't think you're really accessing Active Directory with the code above. You're talking to your Domain Controller with the GetObject("WinNt://" & strDomain). AD is an LDAP provider...
Try this:
Use the GetFolder method on the folder where the files exist.
Loop through the returned GetFolder object with a "For Each... In... Next" loop and pull out the filenames from the Files property of the returned object the GetFolder created.
Stick these into your final log...
From the Windows Script help:
Sleep Method
Suspends script execution for a specified length of time, then continues execution.
object.Sleep(intTime)
Arguments
object
WScript object.
intTime
Integer value indicating the interval (in milliseconds) you want the script process to be...
You might want to use the Windows Script Host method REGREAD instead of scanreg. It'll return the key-value/value-name for the key you specify into a variable. However, if the key doesn't exist it'll error and you'll to add error checking for each key you search for. Here's a little bit of...
I just noticed I didn't really answer your question about what "oPrinter" is. The 'for each oPrinter in oCN' creates a new object called oPrinter that has the properties for each item in the object oCN. So oPrinter.printShareName references the property "printShareName" in...
Oops, theres a typo there. It should read oCN.printsharename.
Anyways, your question makes me think you need an explanation of what's happening in the script:
Set oCN = GetObject("LDAP://OU=Printers,DC=mydomain,DC=com")
'Creates an object called oCN that has all of the items in the...
We've just completed something recently regarding what your want to do. Here's some VBS code that will go out and get the all the printers in AD and print them to a file. The LDAP statement will need to be modified to reflect your AD structure.
Set oCN =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.