help with combining two scripts
Hi,
i am a scripting n00b and found a script i would like to use
to connect to a network share and open the network share.
The script below connects to the network share, but i also would like
explorer to open the "x:" drive after connecting to it.
Can someone please tell me how i can accomplish that in this script?
-->script:
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
' Values of variables set
strDriveLetter = "x:"
strRemotePath = "\\192.168.x.x\blah"
strUser = "user"
strPassword = "password"
strProfile = "false"
' This section creates a network object. (objNetwork)
' Then apply MapNetworkDrive method. Result H: drive
' Note, this script features 5 arguments on lines 21/22.
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, _
strProfile, strUser, strPassword
Thanks!
Kim Tag: Possible to add user to COM Security? Tag: 200111
create user account in windows
I need a vbscript to create user accounts on a windows computer. Its is
a completely local computer, no domain or anything. I saw this script
on Google groups and found that it works for creating 1 user.
----------------------------------------------------------------------------------------------------------------------------------------------
sNewUser = "mini-strator"
sGroupname = "Users"
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
Set oComputer = GetObject("WinNT://" & sComputerName)
Set oUser = oComputer.Create("user", sNewUser)
On Error Resume Next
' save the user
oUser.Setinfo
' If user exists already, we get an error
If Err.Number = 0 Then
On Error Goto 0
oUser.SetPassword "1234"
oUser.Fullname = "John"
oUser.Description = "hi!"
oUser.Setinfo
End If
On Error Goto 0
' Add the user to the group
Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)
' Use error handling in case he is a member already
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0
----------------------------------------------------------------------------------------------------------------------------------------------
However if I change the username and try to create another user, it
doesn't work. For example if I run the above script once, then change
it to:
----------------------------------------------------------------------------------------------------------------------------------------------
sNewUser = "mini-strator"
sGroupname = "Users"
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
Set oComputer = GetObject("WinNT://" & sComputerName)
Set oUser = oComputer.Create("user", sNewUser)
On Error Resume Next
' save the user
oUser.Setinfo
' If user exists already, we get an error
If Err.Number = 0 Then
On Error Goto 0
oUser.SetPassword "1234"
oUser.Fullname = "Betty"
oUser.Description = "hi!"
oUser.Setinfo
End If
On Error Goto 0
' Add the user to the group
Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)
' Use error handling in case he is a member already
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0
----------------------------------------------------------------------------------------------------------------------------------------------
It does not create a new user with the name Betty, just a user named
John. Someone please help me with this. I need it urgently. Tag: Possible to add user to COM Security? Tag: 200109
Consolidate Specific Fields in text files to 1 Big File
i'm newbie in VBScripting and i'd create one script to collect system
information and i have other application that generates logs what i need to
do is to have a VBscript that read log files and ONLY copy some fields then
append it to the output file generated by my first script.
Any Help Tag: Possible to add user to COM Security? Tag: 200106
viewing blobs vbsript asp
Hi
I am trying to set up a view application that will view stored wrd, pdf,
jpg gif files in a larg blob in sql 2000. This is tying in with an older
application that was written by somebody, all i want to do is have 1 view
page that will show a list of the file attachments by id number and if
clicked on will open them in exploer.
thanks
Mike Tag: Possible to add user to COM Security? Tag: 200103
VBScript That Copies Folder Content To Remote Computers
Is anyone that can help me? I trying to create a VBScript copy folder
to remote computer. I would like the VBScript that check to see if that
folder I want to copy already exist on a remote computer, If the folder
exists, then I would like the VBScript to move on the next computer,
and if the folder doesn't exist I would like it to copy the folder to
that remote computer and possible create a log file telling me which
computers completed successfully and which ones didn't Tag: Possible to add user to COM Security? Tag: 200101
Read Registry Key
Please give me a simple VBs that will read the values of 1 Registry key >Put them in
some variables or an array > Then i will do something with that .................
What i want to do is :
Read the values of [HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU]
Put a's value in variable a
Put b's value in variable b
c value in c
d in d
etc. etc.
OR .. . ..
Put a's value in array
Put b's value in the array
etc. etc.
.....
AND Put the value of MRUList in a different variable.
--
Ayush Tag: Possible to add user to COM Security? Tag: 200087
Please Help !! VBscript convert my image/music file into VBscript file
Dear all. I am not sure this is the RIGHT forum, but I hardly need help
from all people who is familiar with VBscript.
I received a email from my friend with attached with a *.vbs file,
which is a image he claimed. After I download the file, the outlook
just asked me to change seomthing, I had choosen NO. But after that, I
found that all my image/music files were changed to VBscript script
file and cannot open it anymore.
I hardly need help to convert the (very important) image files back,
anyone can help me please? Thank you very very very much. Tag: Possible to add user to COM Security? Tag: 200086
Missing vbscript
Hope this is the right newsgroup - if not, apologies.
I have tried to install iTunes on my WinXP laptop, but the installer
says:"iTunes could not be installed because Visual Basic Script
(VBScript) is not installed or has been disabled...."
I've looked at Services, but there is no sign of VB, and a search
doesn't seem to help.
Any suggestions would be welcome.
Thanks Tag: Possible to add user to COM Security? Tag: 200084
Call remote vbscript
In order to make the program visible in the desktop, i create another
vbscript in the remote PC. However, there is no response in the remote
PC. May i know any wrong to the scripts below?
remote vbscript
-----------------------
Option Explicit
Dim strProgram, strComputer, objWMIService, arrProcess, objProcess,
objProgram, intSleep, strShell
strProgram = "calc.exe"
strComputer = "."
intSleep = 15000
set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
set arrProcess = objWMIService.ExecQuery("Select * from Win32_Process")
For Each objProcess in arrProcess
if(objProcess.Name = strProgram)then
objProcess.Terminate()
end if
Next
WSCript.Sleep intSleep
set objProcess = objWMIService.Get("Win32_Process")
set objProgram =
objProcess.Methods_("Create").InParameters.SpawnInstance_
objProgram.CommandLine = strProgram
set strShell = objWMIService.ExecMethod("Win32_Process", "Create",
objProgram)
WSCript.Quit
local script
------------------
Dim sScriptName, sComputerName, oWmi, oWmi_Process, objSWbemLocator
sScriptName = "D:\t.vbs"
sComputerName = "abc"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set oWmi = objSWbemLocator.ConnectServer(sComputerName, "root\cimv2",
"abc", "a", "MS_409", "NTLMDomain:WORKGROUP")
Set oWmi_Process = oWmi.Get("Win32_Process")
oWmi_Process.Create(WScript.FullName & " " & sScriptName)
WSCript.Quit Tag: Possible to add user to COM Security? Tag: 200075
naive question
how can one catch end of file for openastextfile object?
AtEndOfStream is only good for stream and I don't want to use stream because
I want to read line by line Tag: Possible to add user to COM Security? Tag: 200069
shell.run problems :(
I run a php script on localhost that contains vbscript in it to execute
a program, like so:
<?php
$scripter = new COM("MSScriptControl.ScriptControl");
$scripter->Language = "vbscript";
$scripter->ExecuteStatement("Set WshShell =
createobject(\"wscript.shell\")");
$scripter->ExecuteStatement("oExec =
WshShell.Run(\"someprogram.exe\",1,TRUE)");
$scripter->ExecuteStatement("Set WshShell=nothing");
$scripter=null;
?>
Now, if I have someprogram.exe already running, it will jump to that.
If I don't, it will open up a new instance. Great, it works. However,
the new instance is running as a SYSTEM process, and not my login name.
I trying to automate a printout, and I can't set any settings on the
printer for 'system', so it gets all funky.
I have been searching all freaking day for a solution... is there one?
PLEASE HELP :) Tag: Possible to add user to COM Security? Tag: 200068
iTunes Script (easy)...
Hey, try this script out for iTunes (must have iTunes installed).
Problem:
iTunes can run minimized in the systray but in order to play,
pause, volume, etc. you have to maximize it (which can be slow
sometimes).
Solution:
Write a script! Try the following. You can make custom keyboard
shortcuts for these scripts also -- make a shortcut on your desktop
and open properties, then make shortcut key by hitting key of
preference).
'Start Script
#######################################################
Set objApp = CreateObject("iTunes.Application")
objApp.PlayPause
'Here are properties to tinker with:
'objApp.Mute = True '(true to mute, false to unmute)
'objApp.SoundVolume = 100 '(values of 0-100)
'or use the following to increment the volume by 10
'units w/each click or hit:
'objApp.SoundVolume = objApp.SoundVolume + 10
'objApp.Rewind '(use objApp.Resume to stop RW)
'objApp.FastForward '(use objApp.Resume to stop FF)
'objApp.BackTrack '(previous track)
'objApp.NextTrack '(next track)
'objApp.Stop '(stops playback)
'objApp.Quit '(exits/closes iTunes) Tag: Possible to add user to COM Security? Tag: 200065
Help Please
The following has been going on for over a week, and I can't find a
solution:
We send an email to approx. 200 dealers.
The email is generated by a VBScript on a schedule.
The VBScript access' a database for various information.
The email is configured to HTML format.
In the email there are two hyperlinks one to a French URL and one to an
English URL.
[PROBLEM]
When some of the recipients receive the email the hyperlink is broke.
eg. http://www.test.com/test.asp?dealer=1 111
(Spaces in the URL)
Or (this just happened)
eg. http://www.testcom/test.asp?dealer=1 111
(The period between test and com disappeared)
[WHAT I TRIED]
Put the whole thing in table tags with the nowrap attribute.
Tried the <nobr> tag.
Tried the <pre> tag.
Any insight would be very much appreciated. Tag: Possible to add user to COM Security? Tag: 200057
Problems setting user account attributes on win2k member servers.
I have written a simple script that sets the password required
attribute to "Yes" on all systems with local accounts and if the
computer is found to be a domain controller it exits out. The script
works fine on any XP workstation and any windows 2003 member servers
but if i run the same script on a windows 2000 member server, the
script exits out with this error:
Error: : -2147463168
Error (hex) : &H80005000
Source :
Description : An invalid ADSI pathname was passed.
Can anyone help me trouble shoot this behavior? Any answers in how to
fix this error would be greatly appreciated. The script is below:
On Error Resume Next
'Setting Constants:
Const ADS_UF_PASSWD_NOTREQD = &H0020
sfile_out = "c:\temp\Localusers_required_password.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTSOut = oFSO.CreateTextFile(sfile_out, True)
'Getting Computer name:
set oNetwork = wscript.createObject("WScript.Network")
'Determing If the computer is a domain controller, member server, or a
workstation.
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & oNetwork.Computername &
"\root\cimv2")
Set colComputers = objWMIService.ExecQuery ("Select DomainRole from
Win32_ComputerSystem")
For Each objComputer in colComputers
Select Case objComputer.DomainRole
Case 0
strComputerRole = "Standalone Workstation"
Case 1
strComputerRole = "Member Workstation"
Case 2
strComputerRole = "Standalone Server"
Case 3
strComputerRole = "Member Server"
Case 4
strComputerRole = "Backup Domain Controller"
Case 5
strComputerRole = "Primary Domain Controller"
End Select
If strComputerRole ="Standalone Workstation" then
call work1
elseIf strComputerRole ="Member Workstation" then
call work1
ElseIf strComputerRole ="Standalone Server" then
call work1
ElseIf strComputerRole ="Member Server" then
call work1
Else
oTSOut.Write "The computer " & oNetwork.Computername & " is a domain
controller. The script will not be run."
Wscript.Quit
End If
Next
'_______________________________________________________________________________
Sub work1
'Enumerating Users:
Set colUsers = GetObject("WinNT://" & oNetwork.Computername)
colUsers.Filter = Array("User")
For Each objUser in ColUsers
set usr = GetObject("WinNT://" & oNetwork.Computername & "/" &
objUser.Name & ", user")
flag = usr.Get("UserFlags")
If flag AND ADS_UF_PASSWD_NOTREQD Then
oTSOut.Write objUser.Name &": NO Password Required." &VbCrLf
usr.UserFlags = flag XOR ADS_UF_PASSWD_NOTREQD
usr.SetInfo
If Err.Number <> 0 Then
oTSOut.Write "The User's, " & objUser.Name &", password does not meet
the complexity requirements. " & Err.Description &VbCrLf
else
oTSOut.Write "User, " & objUser.Name & ", has had the password
required attribute set to yes."&VbCrLf
End If
oTSOut.Write VbCrLf
Else
oTSOut.Write objUser.Name &": Password Required." &VbCrLf
oTSOut.Write VbCrLf
End If
Next
oTSOut.close
End Sub Tag: Possible to add user to COM Security? Tag: 200051
Encode/Encrypt/Protect VBScripts
We have written some VB scripts that help us manage SQL Logins and
Users.
There is sensitive password data in the scripts and I was wondering
what the best practice is for encrypting or protecting the scripts from
prying eyes.
I saw some posts about the Microsoft Script Encoder, are there any
other options?
Any ideas are greatly appreciated. Tag: Possible to add user to COM Security? Tag: 200050
Ascii Text file to Binary and back again
I have an application written in VBscript. It is proprietary, but I
can add vbs subroutines to it. The file that this application
generates is a 512 x 512 matrix. Each data set in the matrix is
consists of a real and imaginary number(floating point). This file is
passed to a matlab script which performs Fast Fourier Transforms on it
and rewrites the file as text. This file must be moved across a
network that is encrypted. The file is so large that it can take
anywhere from 20 to 45 minutes to move the file. In an experiment I
created a similarly formatted file but it was a byte array, the file
transferred in less than 2 minutes every time.
I need a hint at some vbs code that would take a file which held a
512x512 matrix in text format, convert it to binary so I can get it
across the network, then on the other side convert it back into the
text format.
Thanks
M Tag: Possible to add user to COM Security? Tag: 200047
RND not random
Hello,
rnd() is not random (on my computer)
Does anyone has an option for generating random numbers? I need random
numbers between 0 and a million (1000000)
Thanx,
Marco L.
(my script runs every 30 seconds) maybe I have to do something with the
time!! Tag: Possible to add user to COM Security? Tag: 200043
Control Wireless Configuration
Is there a way to turn on or off the check box within the Network Connection
profile for a wireless adapter that says "Use Windows to configure my
wireless settings"? I am trying to uninstall Thinkvantage Access Connection
and use only the Windows software to create my wireless profiles. I have been
able to create the profiles but need to ensure that the check box for Windows
to control it is on.
Thanks
Talyn Tag: Possible to add user to COM Security? Tag: 200030
How can I adapt WinNT:// Moniker create account to Wbem.Scripting Moniker?
Hi,
It's easy to connect using WinNT:\\ class and add a user account and
add it to the administrators group as seen below in my "create local
user account code." But how does one find all the classes for doing
this the WBem way?
I have found only 1 or 2 WBEM classes and I've used them to connect to
a remote computer, supplying alternate username/password using the Wbem
Moniker as listed in the bottom script snippet.
But once I'm connected using the wbem class, how can I do things like
create and modify local accounts on the remote server as listed in the
"create local user account code"
There seems to be SO LITTLE info on the WBEM classes and methods, like
adding a local account. Lots on AD, and lots on using Winmgmt and
impersonate, but very little out there on wbem monikers using alternate
credentials and the available classes.
Anyone have any insights?
L,
S
'create local user account code begin
Dim strComputer
strComputer = "."
Dim strUsr
strUsr = i
On Error Resume Next
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", strUsr)
objUser.SetPassword "pass123"
objUser.SetInfo
'create local user account code end
'================================== wbem connection conx and gets ip
and mac:
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objWbemLocator.ConnectServer _
(strComputer, strNamespace)', strUserName, strPassword)
objWMIService.Security_.authenticationLevel =
WbemAuthenticationLevelPktPrivacy
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled =
True")
For Each objItem in colItems
WScript.Echo objItem.MACAddress
For Each strAddress in objItem.IPAddress
WScript.Echo strAddress
Next Tag: Possible to add user to COM Security? Tag: 200025
VB script to add alias e-mail to all users
My site is adding a new e-mail for all of my employees and I have to find a
way to add an alias to all mailboxes. Does anyone know of a script that I
can use to make this happen instead of having to go to each invididual user
and manually add them? I'm running E2K3 SP2 and W2K3 SP2 AD
TIA Tag: Possible to add user to COM Security? Tag: 200024
frames
I am trying to implement tabs, here is the code snippet. The code does not
work....why the frame is not set back to yahoo page...any clues
<HTML>
<SCRIPT LANGUAGE="JavaScript">
function tabOnClick(ID)
{
var oElement = null;
for (var i = 0; i < tabs.length; i++)
{
oElement = document.getElementById(i);
oElement.className = "tabOff";
}
oElement = document.getElementById(ID);
oElement.className = "tabOn";
var tab = tabs[ID].split("|");
//divTabFrame.innerHTML = "<IFRAME id='MyFrm' name='MyFrm'
SRC="+tab[1]+" CLASS='tabFrame' FRAMEBORDER='0' SCROLLING='no' ></IFRAME>";
document.MyFrm.src = "http://www.yahoo.com"
document.body.focus();
}
<script>
<BODY onLoad="tabLoad()">
<DIV ID="divTabButtons"></DIV>
<IFRAME id='MyFrm' name='MyFrm' src ="http://www.google.com"
CLASS='tabFrame' FRAMEBORDER='0' SCROLLING='no' ></IFRAME>
</BODY>
</HTML> Tag: Possible to add user to COM Security? Tag: 200020
EnumNetworkDrives skips a drive
All,
I've got a script I'm trying to use to remap drives from one server to
another (contingency plan in case the first server has problems). It
works great... except it seems to skip a drive on my machine. The code
is posted below. When I look in the registry at \HKCU\Network\ I have 4
drives: J, K, Y, Z. However, my script does not appear to look at the J
drive. I used WScript.Echo to verify which drives it is analyzing.
(BTW, I apologize in advance for the poorly written code! Doing two
separate tests [one on name and one on IP] was simply easier than
learning how to do it properly heh]). Thanks in advance!
Option Explicit
Dim objNetwork, objDrive, intDrive, strOldShare,_
strOldIP, strNewShare, strNewUNC, strDriveLetter, objFSO
Set objNetwork = WScript.CreateObject("WScript.Network")
Set objDrive = objNetwork.EnumNetworkDrives
Set objFSO = CreateObject("Scripting.FileSystemObject")
strOldShare = "server1"
strOldIP = "123.123.123.123"
strNewShare = "server2"
'If we have no network drives, quit
If objDrive.Count = 0 Then
Wscript.Quit(0)
End If
For intDrive = 0 to objDrive.Count - 1 Step 2
WScript.Echo "Doing drive " & objDrive.Item(intDrive)
WScript.Echo LCase(objDrive.Item(intDrive + 1))
If InStr (1,LCase(objDrive.Item(intDrive + 1)), strOldShare, 1) > 0
Then
strNewUNC = Replace(LCase(objDrive.Item(intDrive + 1)),
strOldShare, strNewShare, 1, 1, 1)
strDriveLetter = objDrive.Item(intDrive)
WScript.Echo "For " & strDriveLetter & " I will replace " &_
objDrive.Item(intDrive + 1) & " with " & strNewUNC
' Only delete and recreate if the destination exists
If objFSO.FolderExists(strNewUNC) Then
objNetwork.RemoveNetworkDrive strDriveLetter, True, True
objNetwork.MapNetworkDrive strDriveLetter, strNewUNC, True
Else
WScript.Echo "The mapped network drive " & strDriveLetter & " at
" &_
objDrive.Item(intDrive) & " was not mapped to " & strNewUNC &_
".The destination did not exist."
End If
End If
If InStr (1,LCase(objDrive.Item(intDrive + 1)), strOldIP, 1) > 0 Then
strNewUNC = Replace(LCase(objDrive.Item(intDrive + 1)), strOldIP,
strNewShare, 1, 1, 1)
strDriveLetter = objDrive.Item(intDrive)
WScript.Echo "For " & strDriveLetter & " I will replace " &_
objDrive.Item(intDrive + 1) & " with " & strNewUNC
' Only delete and recreate if the destination exists
If objFSO.FolderExists(strNewUNC) Then
objNetwork.RemoveNetworkDrive strDriveLetter, True, True
objNetwork.MapNetworkDrive strDriveLetter, strNewUNC, True
Else
WScript.Echo "The mapped network drive " & strDriveLetter & " at
" &_
objDrive.Item(intDrive) & " was not mapped to " & strNewUNC &_
".The destination did not exist."
End If
End If
Next
WScript.Quit(1) Tag: Possible to add user to COM Security? Tag: 200015
Bringing IE to focus from add-in
We're having an issue in bringing IE to focus on loading from PowerPoint
add-in. Can you please help us in this regard. Steps are:
1) Create a DLL that has a form with a button in it
a) Form should be a modal dialog
b) On Click of the Button Internet Explorer should be automated and made
visible --- shdocvw.dll is used to automate Internet explorer
2) Create an Add-ins referring that DLL
3) Include that Add-ins in excel application
4) Run the Macro of Add-ins to display the Form in DLL
5) Click the button to display IE
6) IE is loaded, but appears in a minimized mode in the Taskbar.
Any Idea to make it visible in maximized mode Tag: Possible to add user to COM Security? Tag: 200005
Help with Calculation of Multiple Records
I need help in calculating a score for each employee based on values
submitted from drop-down boxes
Example:
Emp1 TeamScore(1-10)
Emp2 TeamScore(1-10)
Emp3 TeamScore(1-10)
Emp4 TeamScore(1-10)
Emp5 TeamScore(1-10)
I want to take the values from each drop-down and multiply them by a
weighted score that I get
from another database table (ie 0.11 etc)
I get a Type Mismatch (string) error when I run the following code:
MLevel2 = "0"
On Error Resume Next
Set C9 = Server.CreateObject("ADODB.Connection")
C9.Open "Provider=sqloledb;Data
Source=ebs-sqlc1-vs3.edn.runi.com\SSS;UID=casuser;PWD=hppccas;DATABASE=skills"
Set rsScors= Server.CreateObject("ADODB.Recordset")
sSQ5 = "Select * from WgtScore where org = '" & session("orgg") & "'
AND mgmtlevel = '" & MLevel2 & "'"
rsScors.Open sSQ5, C9, adOpenKeySet,adLockReadOnly, adCmdText
D5 = rsScors("QDiv5")
SS5 = "0.0"
S11 = round(rsScors("WS1"),2)
rsScors.close
set rsScors = Nothing
strID = split(request.form("Emp"), ", ")
QQ1 = split(request.form("Q1")* S11,",")
FOR i = LBound(strID) TO UBound(strID)
sSQL = "UPDATE EAPcurrentyear SET Q1= '" & trim(QQ1(i)) & "' where
(empid ='" & strID(i) & "')"
C9.Execute(sSQL)
NEXT
C9.Close
Set C9 = Nothing
%>
Any help with this would be Greatly appreciated. Tag: Possible to add user to COM Security? Tag: 200002
Enumerating files in a folder beginning with ...
Hello,
I want to do some DIR command with VBscript. The following code is what
i already have:
<code>
Set objFolder = objFSO.GetFolder(DrvLetter & "\")
Set colFiles = objFolder.Files
For Each objFile in colFiles
LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
* BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
Next
</code>
This script enumerate the file name, the filesize in KB's and the Last
Modified date.
Now i want to enumerate only the files beginning with export*.mdb. How
can I do this?
Thnx in advance,
Cees van Altena Tag: Possible to add user to COM Security? Tag: 199998
How to call a remote vbscript from a .Net windows application?
How to call a remote vbscript from a .Net windows application?
For example, there are 2 PC in the network. one is PC1 and another one
is PC2.
1. A vbscript is stored in PC1.
2. windows application in PC2.
In the scenario above, is there any way to call the vbscript which is
located in PC1 from the windows application in PC2. Tag: Possible to add user to COM Security? Tag: 199996
Logic connection between exchange mailboxes and AD?
Hi! :)
I need to get data on our user accounts and the associated exchange
mailboxes. I can enumerate eather separatly but have failed to find a common
property or anything to connect them. I'm sure it's something simple, but
what?
I intend to enumerate one and then search for the matching entries in the
other. So a matching searchable property would be great! :)
Thanks a million! :)
/Sofia Tag: Possible to add user to COM Security? Tag: 199990
Merge script does not merge in order 1, 2, 3.
Hi
The problem is that the merge is not done in order.
Instead of merging 1, 2, 3.. it merges 1, 10, 11, 12, 2, 20, 21 and so
on..
Anyone got some good advise to solve this?
Thanks in advance.
------------------------------------
Option Explicit
dim oArgs: Set oArgs = WScript.Arguments
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
dim filefolder
Dim filefolderN
Dim CurrentFolder
Dim Files
Dim File
dim objts
dim strContents
dim endoffilepos
filefolder = "C:\Test\"
filefolderN = "C:\Test\Data\"
Set CurrentFolder = fso.GetFolder(filefolder)
Set Files = CurrentFolder.Files
For Each fileName In files
If left(File.Name,13) = "NewTestData_1" Then
Set objTS = File.OpenAsTextStream(1)
strContents = objTS.ReadLine
objTS.Close
Set objTS = fso.OpenTextFile(filefolderN & "\NewTestData.", 8,true)
objts.writeline strContents
objts.close
Set objTS = fso.OpenTextFile(filefolder & "\NewTestData.log", 8, true)
strContents = "Merge Completed for " & File & vbcrlf
objts.write strContents
objts.close
File.delete
end if
Next Tag: Possible to add user to COM Security? Tag: 199986
Registry Permissions & Win APIs
Hello all,
First of all, I'd like to apologize if this has been asked before. I
searched the group several times and to my dis-belief my mail reader did not
come up with results. I find this to be very suspicious. Anyway, below are
my questions.
I'd like to modify registry key permissions with VBS and I would like to do
it by using the Win APIs.
I have a key under HKEY_LOCAL_MACHINE that I want to give full rights to
Administrators and System. I want to give read rights to power users and I
want to revoke all other rights for all other users.
I've done VB, but am new to VBS so please do not ostercize me for this noob
question. I have found how to do this in VB using the RegSetKeySecurity
function in advapi32.dll. However, I can't even open a key in VBS using
RegOpenKey because I receive a VBScript compilation error on the declaring
function saying "Expected Identifier"
[code]
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
[/code]
Also, in setting up some constants, I get a compilation error of "Expected
Literal Constant"
[code]
Private Const KEY_SET_VALUE = &H2
Private Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or
KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
[/code]
Is it possible to directly use the Windows APIs from VB Script? If it is
possible, what do I need to do to make this work?
If it isn't possible, then what can I do that will work on Win 2k, XP Pro,
and 2003 to change the security permissions on a registry key?
Thank you,
Travis Tag: Possible to add user to COM Security? Tag: 199982
HTML Tabs
I have 3 ASP pages. I want to create a simple Tabbed layout in DHTML or some
FREE ware code which will host these 3 pages in 3 different tabs...Do you
know if such free code to create tab available...any samples will help
Thanks Tag: Possible to add user to COM Security? Tag: 199979
.bat to VBScript
Will someone please be so kind as to help me translate a .bat to
vbscript? I can't seem to do it despite my best attempts. Here's the
.bat:
@echo off
"\\131.62.80.10\HelpDesk\Scripts\BGInfo\BGInfo Server\BGInfo.exe"
"\\131.62.80.10\HelpDesk\Scripts\BGInfo\BgInfo Server\Server.bgi"
/SILENT /NOLICPROMPT /timer:0
As you can see, I am trying to run the BGInfo app from a share. I don't
want to copy the .bat to everyone's startup folder rather I would like
to run the vbscript command from group policy logon script. Thanks for
any help you can offer.
Tim Tag: Possible to add user to COM Security? Tag: 199978
'loop' without 'do' Error
I am having trouble with the following script file. Please help!!!
'==========================================================================
on error resume next
Set fso = CreateObject("Scripting.FileSystemObject")
Set noton = fso.CreateTextFile("M:\Technical Folder\Secret
Squirrel\Tools\Cool VBS\Multi-Desktop File Copy\error.log") ' path to
error log
'**************************** Start of loop **************************
set bF = fso.opentextFile("M:\Technical Folder\Secret
Squirrel\Tools\Cool VBS\Multi-Desktop File Copy\ComputerList.txt",1) '
open list of machines
Do While bF.AtEndofStream <> True
strmachine = bF.readline
If objFSO.FileExists("\\" & strmachine & "\c$\Documents and
Settings\All Users\Desktop\email.rdp") Then
objFSO.DeleteFile "\\" & strmachine & "\c$\Documents and Settings\All
Users\Desktop\email.rdp", True
If err.number <> 0 Then
noton.writeline strmachine & err.number 'writes to noton.txt machine
that error
End If
err.clear
LOOP
'*************************** End of loop
************************************
wscript.echo "DONE!" Tag: Possible to add user to COM Security? Tag: 199976
Problem with IE7 vbscript and javascript
Hi
I need to call a javascript function from vbscript:
<script type=3D"text/javascript">
function JSAlert(str){
alert(str);
}
</script>
<script language=3D"vbscript">
Sub VideoPlayer_onGoToURL(url,target)
call JSAlert(url)
End Sub
</script>
It doesn=B4t work, but if I put 'msgbox url' before 'call JSAlert(url)'
works.
Could somebody help me? Tag: Possible to add user to COM Security? Tag: 199973
On Change..
Hi, can anyone help me? I am trying to make an input box not visible or
readonly when a slect box above is changed. Here's my code:
<select name=selStake style="Width: 146px;">
<option value="Mentor">Mentor</option>
<option value="Institution">Institution</option>
<option value="None">None</option></select>
And i would like to make this box invisible or readonly when the above
selct box is changed to "None" :
<INPUT name=InstName>
Any ideas or suggestion will be highly appreciated.Thanks Tag: Possible to add user to COM Security? Tag: 199966
vbscript to view users connected to active directory
Hi all,
I need to view who is connected to my active directory 2003 domains
controllers, anyone knows how to do that in vbscript/asp ?
thanx in advance
greets, Greg Tag: Possible to add user to COM Security? Tag: 199962
Script naming problem ( why i should not name my script as Telnet.vbs)
Hi i have written a script to launch the telnet window.
The code is contains the following line
'strPath = Path of the text file to store telnet session
'strHost = host name or IP address\
'numPort = Port number
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd /k telnet -f "&strPath&" "&strHost&" "&numPort
When i save this code as Telnet.vbs and run it, it opens many telnet
windows !
I know that there is nothing wrong with code because when i rename it
to something else, it works fine!
Please inform me why i should not name it as Telnet.vbs (are there any
restrictions or some thing else etc..?) Tag: Possible to add user to COM Security? Tag: 199961
Restart Services remotely
Hi,
Is there a way to connect to another system service.msc to start and stop
remotely, using visual basic or .net.
Thanks
Pete Tag: Possible to add user to COM Security? Tag: 199957
Question regarding FileSystemObject
I am currently working on a project to consolidate our customer's file
& print servers and incorporate the data structures within a DFS-R
design. I have been asked to initially produce a report detailing
compressed files on the source server and calculate the amount of
storage required to store this data in an uncompressed state.
Using vbScript, is it possible to return the compressed size (or Size
on Disk) from FileSystemObject, as opposed to the uncompressed size
returned by objFile.Size?
Any help would be greatly appreciated,
Adam Tag: Possible to add user to COM Security? Tag: 199956
"Clever" way to avoid mapping a drive in network log copy operation?
Hi,
Goal - avoid using a mapped drive or //unc as I grab log files from
multiple servers and copy them to my workstation.
Solution Idea: Instead of copying files the traditional way - Since WMI
seems to be able to communicate and stream data without a mapped drive,
why should I bother? Can't I just use the port and protocol WMI/WSH
uses to stream my data to variables and then write them locally:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFilePath, True)
...pointing to a local file?
Sounds deceptively easy but I don't see many people recommending or
using this method. Pitfalls...am I missing something?
Thanks!
L,
Samiam Tag: Possible to add user to COM Security? Tag: 199943
Lookup fields in active directory
I have a third party program that creates e-mail signatures which I run
from the users login script. Unfortunately the program does not alter
the signature template correctly if a field is blank. There's really
only one field that I'd want to check: Mobile Phone.
Here's what I'd like to do in the login script. If the mobile phone
field is blank run command1 else run command2. I think I can manage
the if...else statement, but how do I retrieve the mobile field from
active directory.
Can anyone help?
Thanks
ab Tag: Possible to add user to COM Security? Tag: 199942
Using SendKeys to respond to a prompt...
Hi-
My environment is Windows 2003 Server SP1. Is it possible to respond to a
command line confirm prompt using send keys? If so, could someone point me
to an example? I've not been able to figure out a way to do this.
The scenario is this: I'm using the command line interface of PGP 7.0x to
encrypt a file before transferring it and the process prompts for a 'Y' to
confirm use of the specified public key. I reviewed PGP documentation and
there is no parameter available to suppress this so I'm trying the sendkeys
approach as a workaround.
I have no problem calling the PGP executable, but I can't get a 'Y' and
'enter' sent to it to get by the prompt..
Any help would be greatly appreciated.
Thanks Tag: Possible to add user to COM Security? Tag: 199936
Microsoft VBScript runtime (0x800A0005) in ASP
Hi members,
When I try to copy a folder contents into another folder of the
same application path, I get
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument.
Can anybody solve this? Tag: Possible to add user to COM Security? Tag: 199931
Vista computername change
Hi,
How do I write vbscript that change Windows Vista computername?
I can run vbscript in vista, but do not know code that allow me to change
computername stored in variable.
Thanks! Tag: Possible to add user to COM Security? Tag: 199928
Get csvdata to server for processing to BE datasource
Hi all,
I'm new to asp.net, and using Visual Web Dev express. As such I cannot
see the spreadsheet control and directly access the object properties
from the VB code in the back of my page.
I have declared it as an object as follows:
<object classid="clsid:0002E559-0000-0000-C000-000000000046"
id="Spreadsheet1" name="Spreadsheet1" style="width: 331px; height:
215px" >
note: all users have Office 2003 Web Components
Can only interact with this user entered data client-side, via
"document.all.item("Spreadsheet1").csvdata"
<input type=hidden id="TextBox1" name="TextBox1" />
Can only use this client side, so I can't get the contents of
spreadsheet in here and use it on the server. (If someone knows how it
can be done, please share )
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"
AutoPostBack="True" Height="76px" Width="99px"
Visible="false"></asp:TextBox>
This is an asp box, so users can interact with, but it is not
recognized in client side vbscript. It works if I make it visible and
paste directly.
I was also unsuccessful at getting a javascript function to recognize
this textbox. I kept getting "Object Required" errors.
What I am trying to do is get the csvdata into my temp table. I tried
to do it in the following function (VB on back) and it works if I can
get the data:
Private Sub fnBeforePaste(ByVal txtPassed As String)
Dim i As Int32
Dim Idata() As String = Split(txtPassed, Chr(13) & Chr(10))
'or use Environment.Newline
If InStr(txtPassed, Environment.NewLine) Then
MsgBox("Environment.Newline")
For i = 0 To Idata.GetUpperBound(0) - 1
Dim stCells() As String = Split(Idata(i), Chr(9)) 'or
use ',' for csvdata
stCells(0) = Replace(stCells(0), Chr(10), "")
If Len(stCells(0)) < 2 Then GoTo ExitPasteGrid
AccessDataSource2.InsertCommand = "INSERT INTO Temptbl
(ESN,[MIN]) SELECT '" & stCells(0) & "' AS Expr1, '" & stCells(1) & "'
AS Expr2;"
'"INSERT INTO Temptbl ( ESN, [MIN] ) SELECT " & stCells(0)
& "," & stCells(1)
AccessDataSource2.Insert()
Next
ExitPasteGrid:
'TextBox2.Text = ""
GridEntry.DataBind()
End Sub
This way I can run a query in the database, and return the query
results in a second grid on the page. I have to use something easy for
users to enter two columns of unknown rows of numerical text values in
a temp table in order to join it to the other query table.
Any suggestions on how to approach this problem are much appreciated.
:) Tag: Possible to add user to COM Security? Tag: 199925
Silent Copy Options
I am using the following:
Set DestFldr=objShell.NameSpace(Ag(1))
Set SrcFldr=objShell.NameSpace(Ag(0))
Set FldrItems=SrcFldr.Items
DestFldr.CopyHere FldrItems, &H214
However, I continually get prompted to overwrite files. Is there a way to
answer "YES FOR ALL"? I thought I have the options correct.
TIA
Mark Tag: Possible to add user to COM Security? Tag: 199923
Create and array from a CSV file
I am in the process of writing a script to rename some computers based
on 3 characters of their current computer name. I have the code to
change the name, but I need a way of getting the new 3 character site
code based on the old 3 character site code. The CSV file is formated
as follows:
OLD CODE, NEW CODE
AL1, AUL
BGS, BHG
ZHG, ZGH
I need help with creating an array and then reading into it the 2
columns of data. Then I need a way of extracting the correct new site
code based on the old site code.
Any help would be greatly appreciated as I am now banging my head
against a brick wall......!!!
THanks
Keith Tag: Possible to add user to COM Security? Tag: 199916
Script to check the ownership of cluster quorum
I need a script to check the ownership of the cluster quorum and if it's
owned by the host the script runs on it should fail the quorum .
Can anyone help me with this ?
thanks
Stefano Tag: Possible to add user to COM Security? Tag: 199915
Read text fiile help..........
Hi there I need some help with reading a CSV file............
I have three parameters I will obtain from the pc, A, B and C.
And then I have a csv file list with different values for A, B and C
I need some help reading the text file such that it will first read all
the entries for value A in the text file and find a match and then find
the match for value B and then find the value for C............
Something like
Read Text file for A and find match
Read text file for B until match
Read Text file for C until match
Basically I want to match values A, B and C then do something
Many thanks Tag: Possible to add user to COM Security? Tag: 199909
IE sequencing and cookie notification popups
Something has been annoying me lately when my script brings up IE and
navigates it to certain pages. I am getting multiple popups asking me
whether I want to allow cookies from the site, and do I want to
uniformly allow free access or block them? These popups seem to happen
whether or not IE is visible, and the popups can even stick around
after the script has terminated and IE has been (or at least attempted
to be) dismissed:
Set ie = CreateObject ("InternetExplorer.Application")
ie.Navigate2
"http://search.ebay.com/search/search.dll?...blah...blah...blah"
...
ie.Quit
So, how can I get rid of these pesky popups? The pages navigate fine
(pretty much), and the script runs through to completion (I have a
sequence of page navigations), so these cookies are not that important
for me to set, but I don't want to deny them uniformly since that might
affect my personal browsing.
What I'm saying is: I don't want to have these cookie notification
popups when I am bringing up IE via script, but otherwise they are
serving a useful purpose. Any tips on how to turn this off for
scripted IE (IE 6 on Win XP Pro)?
Thanks,
Csaba Gabor from Vienna Tag: Possible to add user to COM Security? Tag: 199906
string combination script?
Does anyone have an example of vbScript that provides a listing of all
string permuations from a given input string? It appears to be more
difficult to actually get a VbScript example that works - I can find
php, java etc etc examples... but not vbscript.... Tag: Possible to add user to COM Security? Tag: 199904
Is it possible to script adding a user to COM Security in Access
Permissions within DCOM (dcomcnfg)?