HELP: Event handling for WIA with VBScript
I need some help with Event handling for WIA through VBScript
Apparently the event handling for devices through WIA has not work for a lot
of people my online research says.
Code:
devMan.RegisterEvent wiaEventDeviceDisconnected, wiaAnyDeviceID
Private Sub devMan_OnEvent(EventID, DeviceID, ItemID)
MsgBox("it works!")
End Sub
Code Ends
According to MS documentation for WIa online this should work. Yet it does
not. Not for me and for a lot of ther people online I've found. Could this be
a security issue in Windows? or simply a MS bug not yet found?
Thanks for any help in advance Tag: script to add domain user to computers Tag: 214641
File Size Check
I have a simple batch file that FTP's out to a server, logs in, retrieves a
file and places it on my server and then here's where I run into a problem.
When it was written in XP the batch then checked the size of the file and if
it was greater than 0, the batch ended and was done. If the file was not
greater than 0, it slept for 20 minutes (echo sleep 1200) and then re-ran the
FTP process.
Now that this is on Windows 2000, I can't figure out how to make it work.
Here are the two files that were run:
@echo on
del para2.txt
echo open XXXXXXXXXXXXXX >> para2.txt
echo user XXXXXXXXXXXXXXXXX >> para2.txt
echo binary >> para2.txt
echo hash on >> para2.txt
echo GET XXXXXXXXX >> para2.txt
echo DEL XXXXXXXXX >> para2.txt
echo quit >> para2.txt
progs.bat abc.123.tag
@echo on
del %1
:START
ftp -n -s:para2.txt
if %~z1 GTR 0 goto :END
sleep 1200
goto :START
:END
del para2.txt
Any ideas on how to make this work in Windows 2000? Tag: script to add domain user to computers Tag: 214638
Script to Set Internet Explorer Security Parameters
Is there a way to write a script that will set the various Internet Explorer
Security Settings for particular zones? For example, the settings that affect
activeX controls and scripting? I could try to figure out how to hack the
registry, but would prefer a documented interface, if one is available.
Thanks,
--
Joseph Tag: script to add domain user to computers Tag: 214634
Can I use system.net.* in VBScripts?
The goal: to run a web service in a Internet Explorer page. Can it be
done?
The only way I see is to have a VBScript able to import the functions
from System.Net.Sockets.TcpListener. Is it possible? examples? Do the
user needs to have some or all of the .NET framework installed?
Thanks
Alejandro Tag: script to add domain user to computers Tag: 214633
inconsistent EnumValues behavior? is there a work-around?
Say I have the following script:
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1
Dim arrKeys, arrTypes
Dim oReg: Set oReg = GetObject("winmgmts:root/DEFAULT:StdRegProv")
oReg.EnumValues HKEY_CLASSES_ROOT, ".txt", arrKeys, arrTypes
Dim i, value
If Not IsNull(arrTypes) Then
For i = LBound(arrTypes) to UBound(arrTypes)
If arrTypes(i) = REG_SZ Then
oReg.GetStringValue HKEY_CLASSES_ROOT, ".txt", arrKeys(i), value
MsgBox value
End If
Next
End If
Using .txt, I get three popups. One for the default value name, one
for 'Content Type', and
one for 'PerceivedType'.
For .key, there's only one value name - the default one. It's valueis
regfile and is of type REG_SZ. Yet I get an error when the
abovescript runs on .key. My question is... why? Why would
EnumValues include the default value in its enumeration when the
default value isn't the only one while, at the same time, not
including the default value when it is the only one? Is there a work-
around? Tag: script to add domain user to computers Tag: 214625
Vbscript - terminate script by pressing Crtl-C
Hi,
I have written a vbscript that takes input from user.
Is there any function we can use if script get timout automatically OR user
has not provided a specific input during that time OR user will terminate
script by pressing Crtl-C. Then system should logoff automatically.
regards
Raj Tag: script to add domain user to computers Tag: 214624
Multi-dimensional ArrayList in VBScript (using .NET framework): is that possible ?
Hello.
I'm facing a problem that apparently is not well documented on the web. I'm
trying to istantiate an ArrayList in VBScript (on an classic ASP page).
A code like the following works fine (provided the framework is installed
naturally):
Set al = CreateObject( "System.Collections.ArrayList" )
al.Add "F"
al.Add "B"
al.Add "D"
al.Add "C"
call al.insert(2,"john")
My problem is: I would like to create a multi dimensional ArrayList. It is
quite a normal thing in C# but I really can't find out wich is the correct
syntax in VBScript.
I'm persuaded that it should be possible to do that; one is supposed to be
able to use any kind of feature of the .NET class even in VBScript... Is
there anyone who can provide a working code for my needs ?
I thank you in advance for any help.
Newcomsas Tag: script to add domain user to computers Tag: 214618
problem parsing recipients from email to field
hello, I have an event sink that traps mail going through the smtp
server.
I need to parse the msg.to field so that I can get each single user:
the string looks like this:
"Johnny Lance (BCO-London)" <jlance@bco.net>, "lhughes@bco.net"
<lhughes@bco.net>
basically I need to get the smtp address of each recipient, the one
between the "<" and ">". The recipents could be just one or a few. So
I would need to cycle through this list but honestly I have no idea
how build this array in a vbscript.
Anybody can give a hand ? It would be much appreciated.
Thanks in advance.
Regards,
zz Tag: script to add domain user to computers Tag: 214615
enumerate windows components
I have been searching for a script that will return all of installed windows
components such as IIS, WWW, SMTP, etc...Then I want to be able to for
example if IIS is installed, enumerate the websites and dump the
configuration into a file similar to rick-click export in the mmc console.
Any help would be appreciated.
Thanks,
Aaron Tag: script to add domain user to computers Tag: 214613
Add Users to Group [WP]
I have a Sharepoint Group in AD. I want to run some sort of script
(everyday) which adds all the users from our AD with and without emails to
this group. I also want the script to check that if the users already
exists
in the group ... do not add them instead move on and only add the newly
created users in AD to this group.
If possible also generate a small text file about the results on the script
ran.
Is this possible?
TIA Tag: script to add domain user to computers Tag: 214612
Unsecapp.exe and wmiprvse.exe
I'm using XP Prof SP2 and VBScript, WSH v5.7
I have a script installed on a remote machine, ComputerB. On the local,
ComputerA, are two scripts which start and stop the script on ComputerB.
The script on ComputerB makes two ExecNotificationQueryAsync calls and
reports by e:mail when the specified events occur.
When the script is started, from ComputerA, two instances of wmiprvse.exe
are started, on ComputerB, and a single Unsecapp.exe. That's all fine.
The script is kept 'live' with a Do-Sleep-Loop.
I'm trying to discover if there's a way of stopping the ComputerB script
gracefully, so that it can call the .Cancel method on the two Async calls.
At present, the ComputerA Stop script simply .Terminates the WScript process
on ComputerB, but this leaves the two wmiprvse.exe and the Unsecapp.exe
still running on ComputerB.
For now ComputerA, stops and starts WMI and .Terminates Unsecapp, leaving
ComputerB in a 'clean' state.
This seems a bit ham fisted when .Cancel would, effectively, do this for me. Tag: script to add domain user to computers Tag: 214610
disable excel "This workbook contains links to other data sources"
I would have expected the ""This workbook contains links to other data
sources" alert to be disabled by the "objMyExcel.DisplayAlerts =
False" line, but the alert keeps coming. I would like to set it to
"Yes" always.
See code below.
<vbscript code>
Set objMyExcel = CreateObject("Excel.Application")
objMyExcel.Visible = False
objMyExcel.DisplayAlerts = False
On Error Resume Next
Set objMyWorkBook = objMyExcel.Workbooks.open(inputFile)
If (Err.Number <> 0) Then
objExcel.Application.Quit
WScript.Echo "open(" & inputFile & ") failed err=" &
Err.Description
WScript.Quit Err.Number '
End If
</vbscript code> Tag: script to add domain user to computers Tag: 214608
HELP: Procedure...has too many arguments specified (?)
Here's the scenario. My stored proc (on SQL Server 2000) reads thus:
CREATE PROCEDURE dbo.spContactUpdate
(@ContactName nvarchar(50),
@FirstName nvarchar(50) = null,
@LastName nvarchar(50) = null,
@Address1 nvarchar(50) = null,
@Address2 nvarchar(50) = null,
@City nvarchar(50) = null,
@ST nvarchar(50) = null,
@Zip nvarchar(10) = null,
@Phone1 nvarchar(50) = null,
@Phone2 nvarchar(50) = null,
@Fax nvarchar(50) = null,
@Cell nvarchar(50) = null,
@email nvarchar(50) = null,
@ContactID int
)
AS
Update [dbo].[contacts]
set [ContactName] = @ContactName,
[FirstName] = @FirstName,
[Address1] = @Address1,
[Address2] = @Address2,
[City] = @City,
[ST] = @ST,
[Zip] = @Zip,
[Phone1] = @Phone1,
[Phone2] = @Phone2,
[Fax] = @Fax,
[Cell] = @Cell,
[email] = @email
Where Contact_ID = @ContactID
My ASP code reads like this:
cmd.CommandType = AdCmdStoredProc
cmd.CommandText = "spContactUpdate"
cmd.parameters.refresh
'cmd.Parameters.Append cmd.CreateParameter ("RETURN_VALUE",
adInteger, adParamInput, NULL)
cmd.parameters("@RETURN_VALUE") = NULL
cmd.parameters("@ContactName") = strContactName
cmd.parameters("@FirstName") = strFirstName
cmd.parameters("@LastName") = strLastName
cmd.parameters("@Address1") = strAddress1
cmd.parameters("@Address2") = strAddress2
cmd.parameters("@City") = strCity
cmd.parameters("@ST") = strST
cmd.parameters("@Zip") = strZip
cmd.parameters("@Phone1") = strPhone1
cmd.parameters("@Phone2") = strPhone2
cmd.parameters("@Fax") = strFax
cmd.parameters("@Cell") = strCell
cmd.parameters("@email") = stremail
Set paramId = cmd.CreateParameter("@contactid", adInteger,
adParamInput, , strContactID)
cmd.Parameters.Append paramId
cmd.Execute
(for the @ContactID param, I had to write it this way for it to even
run past this point.)
I get the error, "Procedure or function spContactUpdate has too many
arguments specified.", and I check the params by iterating through
them, and get this:
@RETURN_VALUE:
@ContactName: A Little Mouse
@FirstName: Mickey
@LastName: Mouse
@Address1: Addr2
@Address2: Addr2
@City: Burgerville
@ST: AL
@Zip: 38501
@Phone1: 910-290-3942
@Phone2: MyPhone2
@Fax: 801-653-7029
@Cell: 910-444-0932
@email: elbjay2000@mailinator.com
@ContactID:
The first parameter, @RETURN_VALUE, shouldn't be there, and I can't
get rid of it. Outside of this, I think it should work like a charm.
I can't say why my contactID doesn't show at this point. Sorry for all
the details, but I know this is complicated and I wanted to give all
the facts.
Any advice? (please)
Thx! Tag: script to add domain user to computers Tag: 214605
Compare date and time
Hi
I need to compare 2 date and time values each one in this format #27-
Jan-2008.21:00#
Now I want to use the datediff to compare them but first I need to
change the format
I successfully used the cdate function to change the format of the
date and the time but not when they are together
Any suggestions on how can I compare them ? Tag: script to add domain user to computers Tag: 214569
Shortcut Parameters
I'm trying to find the proper syntax for creating a shortcut with parameters
to my .vbs file. In SHORTCUT SYNTAX below, I listed how I've always created
a shortcut on the desktop to launch my .vbs file. I listed my code below,
but I will be needing to pass 2 parameters for my real script.
For my example below, what should the Target syntax be to pass a parameter
to my .vbs file?
SHORTCUT SYNTAX:
To run from a shortcut, I create a new shortcut on the desktop with
%windir%\System32\wscript.exe //Nologo c:\data\scripts\myscript.vbs as the
Target and
%windir% as Start In parameter.
CODE:
Set colArgs = WScript.Arguments
iState = LCase(colArgs(0))
Select Case iState
Case "Enable" blnState = True
Case "Disable" blnState = False
Case Else WScript.Echo "Please enter the script name followed by a " & _
"space and a parameter." & _
VbCrLf & "Valid names are: Enable and Disable." _
: WScript.Quit
End Select
If blnState = True Then
MsgBox "Enable!"
Else
MsgBox "Disable!"
End If Tag: script to add domain user to computers Tag: 214568
running Excel with VBscript
Hi,
I am writing a script that takes a file name on the command line and
then tries to open the file and runs a macro in the file. I'm a newbie
on VBscript btw.
The problems:
1)
If the user supplies a file name that does not exist, the script
prints some error message to the command line, but the Excel object
does not disappear.
If I try this 10 times, 10 EXCEL.exe processes will show up in the
task manager. Is there any way to have any unclosed handles/objects to
be cleaned up automatically in the case of errors?
2)
Some excel files asks for links to be updated with a message box, but
I want this to run noninteractively and always want to "not update",
can this behaviour be set in the script?
Best Regards,
Adam Tag: script to add domain user to computers Tag: 214563
VBScript and windoes Mobile
Hi
I'm trying to run a short VBscript script file that popup a window to the
user and the user can press OK or Cancel buttons.
When I run the script (via CScript or WScript) it runs properly but in
Windows Mobile (on HTC Tytn2 device) nothing happens.
Here is an example of the script:
sub testing()
dim answer
answer=MsgBox("Hello everyone!",65,"Example")
end sub
Thanks
Aviad Tag: script to add domain user to computers Tag: 214562
Netbios file shares via WMI?
Can I create and manage NetBIOS shares on an XP PC using WMI?
If not, is there any procedure to create and manage file shares using
generic VBScript?
For the curious:
I need to replicate my office network structure on a development
laptop in my home, in order to test an application that makes generous
use network resources via UNC-style paths. I have already written a
WMI vbscript that uses the lanmanserver 'OptionalNames' registry key
to define Netbios aliases matching the server names at the office; I
now need to share local folders, giving them the share names that
match those on the office servers. The end result being C:\work-from-
home\db is AKA \\Workserver1\database_share, and C:\work-from-home
\files is AKA \Workserver22\file_share; the app thinks it's in the
office, without having to be reconfigured in any way.
I need to _script_ this process because a) the work is constantly
changing, and b) if I have \\Workserver as an OptionalName for my
laptop, and I bring that laptop into the office for any reason, and \
\Workserver happens to be rebooted, there will be a name conflict
(it's actually happened).
Thanks! Tag: script to add domain user to computers Tag: 214559
Connection to network printers
For the longest while I have been attemtping to assemble a script to add my
network printers to Windows XP desktops. based on trial and error...I was
able to put together the following vbs script:
Set objWMIService = GetObject("winmgmts:")
sCmd = "rundll32.exe printui.dll,PrintUIEntry /if /b
""helpdesk_hpdj4000ps"" /f" _
& " L:\Drivers\Printers\XP\HPDJ4000ps\hpi4000d.inf /r" _
& " ""\\helpdesk\helpdesk_hpdj4000ps"" /m ""HP Designjet 4000ps PS3"
cmd = "control printers"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCmd, 1, True
oShell.Run cmd
sCmd = "rundll32.exe printui.dll,PrintUIEntry /if /b
""helpdesk_hp4500"" /f" _
& " L:\Drivers\Printers\XP\HPCLJ4500\hpbf232i.inf /r" _
& " ""\\helpdesk\helpdesk_hp4500"" /m ""HP Color LaserJet 4500 PCL 6"
cmd = "control printers"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCmd, 1, True
oShell.Run cmd
sCmd = "rundll32.exe printui.dll,PrintUIEntry /if /b
""helpdesk_hp4200"" /f" _
& " L:\Drivers\Printers\XP\HPLJ4200\PS\hp4200ps.inf /r" _
& " ""\\helpdesk\helpdesk_hp4200"" /m ""HP LaserJet 4200 PS"
cmd = "control printers"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCmd, 1, True
oShell.Run cmd
WScript.Echo "All network printers have been added to desktop!"
The installation itself works perfectly. However, after a few hours the
connection status changed from "Ready" to "Offine". Interesting enough,
users can print without problems although the status says "Offline".
Does anyone have any thoughts on fixing this Offline problem? Thanks a ton.
Peter. Tag: script to add domain user to computers Tag: 214557
VB Script for Legato Networker
Hi there
I am a total newbie to VBScripting and was wondering if someone can help out
here.
I am trying to write a vbscript that I can run to label all my tapes that
are inserted into backup drives in all our Regional Office. (about 13
Offices)
Labeling, mounting tapes, etc can all be done with the Legato command line,
But I would like to automate all this.
The only thing is I want legato to check what tape is currently loaded in
the drive and then if it is the right media to label it. If it is not the
right label it must prompt you for the correct tape.
I know how to check the current loaded media with the legato commands.
So in short:
I have the vbscript to tell legato to check what media is loaded. If it is
the right media then to label the tape with a label. And it is not the right
media to prompt your for the right media to be inserted into the backup
drive.
Please can someone help.
If you need any additional information please let me know.
Thanks Tag: script to add domain user to computers Tag: 214554
Change the description of printers in ActiveDirectory
Hi,
I want to change the description of a printer
in ActiveDirectory with VBScript.
The description should be the same like the attribut driverName
Is it right that I must change this description with WMI
on the server the printer is shared an not in ActiveDirectory ?
This is my code to get the description,
But how to write the description
(only if it's not WMI but writing directly in AD) ?
'-------------------------------------------------------------------
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select description,drivername, serverName from
'LDAP://OU=OUNAME,DC=DCNAME1,DC=DCNAME2' where objectClass='printQueue'
and serverName = '*Servername*'"
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("drivername").Value
Description = objRecordSet.Fields("description")
If NOT IsEmpty(description) Then
For Each strdescription In description
Wscript.Echo strdescription
Next
end if
objRecordSet.MoveNext
Loop
objConnection.close
'-------------------------------------------------------------------
Thanks Tag: script to add domain user to computers Tag: 214534
Sendkeys, Appactivate and inconsitency
Ok, here is the deal. I've written a web page that has an input
form with as many as 30-40 variables. Hitting submit starts a
VBScript. So I start out the script and I focus on the main app
first, then I focus on the window that is being used in the app, then
I send a command to open a text box in that Window, then I send the
text contained in the variables (As well as some additional text) to
that text box. The problem being that this does not work
consistently. Sometimes None of the variables I am sending make it to
the text box, sometimes half of them make it to the text box,
sometimes all. I posted a bit of the script so you can have the
general idea behind it. I am having no problems with validating
variables, etc.....just getting them to send.
Would I be better off creating a single variable by continuing to
concantinate it every time an individual variable is validated? Or is
there a better way?
dim objShell
Set ObjShell = CreateObject ("Wscript.shell")
objShell.AppActivate("Main App")
objShell.AppActivate("Sub Window")
objShell.SendKeys "+{F6}" (Opens Text Box)
objshell.AppActivate ("TextBox")
if not document.Inputform.strfw.value = "" then
objShell.Sendkeys ("STRFW: " & document.Inputform.strfw.value &
chr(10))
end if
if not document.Inputform.strHeaderHeight.value = "" then
objShell.Sendkeys ("HeaderHEIGHT: " &
document.Inputform.strHeaderHeight.value & chr(10))
end if
if not document.Inputform.strTransHeight.value = "" then
objShell.Sendkeys ("TransHeight: " &
document.Inputform.strTransHeight.value & chr(10))
end if
Thanks,
Andy Tag: script to add domain user to computers Tag: 214530
usb write blocker
I am trying to add a script or reg setting that will block the writing to a
usb device and it's not quite working.
Ideally I don't want any users to be able to copy any files to a usb drive
or copy a file from usb to the local hard drive.
The mouse and printer uses the usb ports so they can't be disabled. I tried
a reg setting that blocks writing to usb devices, but doesn't do anything.
"hklm\system\currentcontrolset" dword writeprotect to 1.
I can still copy and move files to the usb drive. I haven't seen any
difference.
Is there a script that may accomplish the same task if not more? Tag: script to add domain user to computers Tag: 214529
Using XCACLS in VBS - why does it keep slowing down?
I have a csv file that contains about 8000 rows. Each row contains a student
username, professor username, and class name. I also have a vbs file that
loops through each row in the csv file, using %COMSPEC% with mkdir and
xcacls to create a directory structure for each class in our college. For
each class' directory, the professor is given full access and each student
is only given full access to their personal folder within the directory.
There is also a shared folder within each class directory; the students are
given read access to this folder and the professor is given full access.
Domain Admins are given full access to everything.
The script to create all of this works fine and all of the directories and
permissions are created perfectly. But here is what I don't understand: The
script starts off working very efficiently - creating about 1,600 folders in
the first hour. But it gradually slows down as it goes along. After about 10
hours of running, it is only creating about 600 folders/hour. The end result
is that it takes over 13 hours to complete when (based on the first hour) I
expected it to finish in 5 hours or less.
One possibility is that the script slows down because it has to modify the
ACLs on all those shared folders, some of which can contain up to 50 ACL
entries by the time it completes. Another possibility is hardware
limitiations, but I don't think so -- I'm running the script on a 3.0GHz
Intel P4 Dual Core processor with 2GB or RAM running WinXP Pro and the
performance monitor is indicating both the CPU and memory utilizations are
below 50%. I don't think it's a network issue either - I ran the script on
my local drive and it experiences the same slow down as it does running on a
network drive. Perhaps it is a Windows limitiation? I've run a Unix-based
script using the same logic against the same csv file using the same mkdir
and cacls commands, and it completes in about 4 hours. But for some reason
the unix solution causes inheritance problems in some of the directories,
which is why I tried using a Windows solution instead.
Does anyone have an idea why my vbs script is slowing down like this? Thanks
for any help out there... Tag: script to add domain user to computers Tag: 214524
Need help for a new scripter
hi there,
I am a verybasic scripter and am in need of some guidence. I have
been tasked with comming up with a script that will allow me to move
folders from the logged in user's profile to a share on the network
and to create a folder the same name as the user it was copied from.
I have found some snipets that have allowed me to copy the files I
want, but need to know the exact path. What I am looking for is a way
to get the logged on user or last logged on users name, create a
folder on a share on the network or even the local drive and copy
folders from the profile into it . I can create the folders thru a
script and move files, but don't want to have to write 75 different
scripts for each indiviual computer to get the folders moved. below
is my attempt at creating what I needed. Please no laughing :). Any
help or input would be greatly appreated.
Daryl
On Error Resume Next
Dim objFSO
'new folder to create. The parent folder must already exists
strFldr="C:\temp"
set objFSO=CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder(strFldr)
set objFSO=Nothing
'Create Folder
On Error Resume Next
rem dim objFSO
'new folder to create. The parent folder must already exists
strFldr="C:\temp\%userprofile%"
set objFSO=CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder(strFldr)
set objFSO=Nothing
Const OverWriteFiles = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Documents and Settings\%username%\Application
Data\Microsoft\Internet Explorer\Quick Launch" , "C:\temp\%username%
\quicklaunch" , OverWriteFiles
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Documents and Settings\%username%\desktop" , "C:
\temp\%username%\desktop" , OverWriteFiles
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Documents and Settings\%username%\Favorites" ,
"C:\temp\%username%\Favorites" , OverWriteFiles
On error Resume Next Tag: script to add domain user to computers Tag: 214523
is it possible to change setting for remote desktop conenction via script/batch file?
how can I use vbscript or batch file to change RDP settings such as enabling
or disabling "allow remote desktop connection", adding/removing user groups?
Don't mind having windows prompting user on execution
also how to change default administrator login account from allowing many
password guess to time out after say 3 consecutively failed attempts Tag: script to add domain user to computers Tag: 214522
WMI - how to update information
I am looking for some guidance on how to update some information in WMI...
What I want to do is add my own Class that has info something like this:
physical location
Support person
Support Group
Data Center Location
Rack location
etc etc... Is this possible? Tag: script to add domain user to computers Tag: 214510
execute script from remote workstation
Is there a way I can run basic batch file from the command prompt for another
workstation? Tag: script to add domain user to computers Tag: 214508
Disk Space help
I have the following code inserted into a script I am working on and need
some help with two items.
1. How can I get the totalsize formated into MB
2. The strFile.WriteLine at the bottom keeps giving me an error. IT doesn't
seem to like the double )). How do I fix this.
Please bear in mind that noob status would mean I know more than I currently
do. Be gentle.
The code below is a snippet from my script.
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = 3")
For Each objDisk in colDisks
intFreeSpace = objDisk.FreeSpace
intTotalSpace = objDisk.Size
strFile.WriteLine(intTotalSpace)
pctFreeSpace = intFreeSpace / intTotalSpace
strFile.WriteLine(objDisk.DeviceID, FormatPercent(pctFreeSpace))
Next
Thanks,
Aaron Tag: script to add domain user to computers Tag: 214504
Include a vbs file into another vbs file
Hi,
I have som common procedures in my logon files and I want to gather all
these in a file general-logon.vbs
Then I want to make user group specific logon files which all starts by
including this general-logon.vbs file at the top.
What is the syntax for including a vbs file in this scenario?
Jake Tag: script to add domain user to computers Tag: 214499
FSO copy and move progress report
This is a multi-part message in MIME format.
------=_NextPart_000_0132_01C85F74.55781FC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello
I was playing around testing a script to copy or move files to a =
directory. The script works well however I wonder if there is a way to =
monitor the progress of such copy or move action
Set fso =3D CreateObject("Scripting.FileSystemObject")
fso.CopyFolder sPathFrom, sPathTo,true
msgbox "done!"
if there are 100 big files to copy, is there a way to show the progress? =
or at least the number of files processed vs remaining?
thanks in advance
--=20
**********
Rafael T
------=_NextPart_000_0132_01C85F74.55781FC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I was playing around testing a script =
to copy or=20
move files to a directory. The script works well however I wonder if =
there is a=20
way to monitor the progress of such copy or move action</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Set fso =3D=20
CreateObject("Scripting.FileSystemObject")<BR> =
fso.CopyFolder=20
sPathFrom, sPathTo,true</FONT></DIV><FONT face=3DArial size=3D2>
<DIV> msgbox "done!"</DIV>
<DIV> </DIV>
<DIV>if there are 100 big files to copy, is there a way to show the =
progress? or=20
at least the number of files processed vs remaining?</DIV>
<DIV> </DIV>
<DIV>thanks in advance<BR>-- <BR>**********<BR>Rafael T</DIV>
<DIV> </DIV>
<DIV></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0132_01C85F74.55781FC0-- Tag: script to add domain user to computers Tag: 214496
inconsistent EnumValues behavior?
Say I have the following script:
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1
Dim arrKeys, arrTypes
Dim oReg: Set oReg = GetObject("winmgmts:root/DEFAULT:StdRegProv")
oReg.EnumValues HKEY_CLASSES_ROOT, ".txt", arrKeys, arrTypes
Dim i, value
If Not IsNull(arrTypes) Then
For i = LBound(arrTypes) to UBound(arrTypes)
If arrTypes(i) = REG_SZ Then
oReg.GetStringValue HKEY_CLASSES_ROOT, ".txt", arrKeys(i), value
MsgBox value
End If
Next
End If
Using .txt, I get three popups. One for the default value name, one
for 'Content Type', and
one for 'PerceivedType'.
For .key, there's only one value name - the default one. It's value
is regfile and is of type REG_SZ. Yet I get an error when the above
script runs on .key. My question is... why? Why would EnumValues
include the default value in its enumeration when the default value
isn't the only one while, at the same time, not including the default
value when it is the only one? Tag: script to add domain user to computers Tag: 214486
Make subroutine...
Hi,
At the bottom of this post is an excerpt from my logon file.
I want to make a common subroutine for the three network drive mappings
below so I can map the drives like this:
MyMapRoutine("R:","\\Server1\Common$","Common resources")
MyMapRoutine("S:","\\Server1\Info$","Information")
... etc
What is the syntax for such a subroutine in this case...?
regards
John
Dim strUserProfile, strUserName, strComputerName, strFolder, strDriveLetter
Dim nwo, sho, fso, sao, tfo
Set nwo = CreateObject("WScript.Network")
Set sho = Wscript.CreateObject("Wscript.Shell")
Set fso = wscript.CreateObject("Scripting.FileSystemObject")
Set sao = CreateObject("Shell.Application")
strUserProfile = sho.expandenvironmentstrings("%Userprofile%")
strUserName = sho.expandenvironmentstrings("%Username%")
strComputerName = sho.expandenvironmentstrings("%Computername%")
strDriveLetter = "R:"
WSHNetwork.RemoveNetworkDrive strDriveLetter, True, True
wscript.sleep 300
nwo.MapNetworkDrive strDriveLetter, "\\Server1\Common$"
sao.NameSpace(strDriveLetter).Self.Name = "Common resources"
strDriveLetter = "S:"
WSHNetwork.RemoveNetworkDrive strDriveLetter, True, True
wscript.sleep 300
nwo.MapNetworkDrive strDriveLetter, "\\Server1\Info$"
sao.NameSpace(strDriveLetter).Self.Name = "Information"
strDriveLetter = "T:"
WSHNetwork.RemoveNetworkDrive strDriveLetter, True, True
wscript.sleep 300
nwo.MapNetworkDrive strDriveLetter, "\\Server1\Installations$"
sao.NameSpace(strDriveLetter).Self.Name = "Software installation files" Tag: script to add domain user to computers Tag: 214484
Using Script from Input File to Write Output File
I don't really know how to phrase what it is that i want but I hope
that someone understands what I'm trying to do.
I can generate a input file that will look something like this:
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3282kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3293kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3304kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3315kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3326kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3585kmg01s1
and generate a .bat file that will look like this:
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3532kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3532kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3536kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3536kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3540kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3540kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3544kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3544kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3548kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3548kmg01s1.pdf
pause Tag: script to add domain user to computers Tag: 214483
How to read data from MS Access?
I have a vbs file that uses a Do loop to read through hundreds of rows in a
csv file. There are 6 columns in each row and the values are assigned like
this:
arrUserInfo = split(objTextFile.ReadLine,",")
strFirst = arrUserInfo(0)
strSecond = arrUserInfo(1)
strThird = arrUserInfo(2)
strFourth = arrUserInfo(3)
strFifth = arrUserInfo(4)
strSixth = arrUserInfo(5)
This works fine but I would rather have my vbs file read the data from the
original source, which is a table in MS Access.
Does anyone know how to loop through an Access table and assign values like
this in vbs?
Thanks! Tag: script to add domain user to computers Tag: 214481
logon script
I need a select case statement that will map drives based on users groups and
server names.
Got the user side down but only want some mapping to occur when users log
into specific server and not anywhere else.
Thanks.
Steve Tag: script to add domain user to computers Tag: 214479
Logon Script copy files
Hi,
I used to use .bat files for my logon scripts to map network drives and
perform a couple of other functions. Now I am using VBS logon scripts, but
since my scripting experience is minimal, I cannot perform the other
functions. Could someone please provide me with the VBS equivalent to these
batch file commands:
:COPY
if not exist c:\folder\file.exe goto :END
(Program does not exist on their system, they do not need the replacement
file)
xcopy \\server\folder\file.exe c:\folder\ /o /y (Copies
file to computer overwriting existing file)
:END
Thanks in advance.
M Tag: script to add domain user to computers Tag: 214478
Script to restart process...
I am very new to VBS, but thought I could create a simple script that
would be scheduled to run a couple times a day to make an archive of
my webcam video.
I created the script, but it doesn't work sometimes. Here is what it
does: Stop program (dorgem.exe), move webcam video to Archive folder,
start program (dorgem.exe).
It works great, except sometimes dorgem does not close. If I use the /
F option with taskkill the program does not start up properly the next
time. I think the solution would be to have the script verify that
the process "dorgem.exe" halted and then continue with the file move,
and if the program did not halt try again 60 seconds later (It seems
to work after the 2nd or 3rd time if I do this manually from the
command line).
Can anybody give me some clues on how to do this? I cant seem to find
the answer online.
Here is my script...
'This script closes dorgem, moves a file, then opens dorgem.
'
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("taskkill /IM dorgem.exe")
WScript.sleep 2000
Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run ("C:\Windows\system32\cmd.exe")
WScript.sleep 1000
'WshShell.SendKeys "move ""C:\Documents and Settings\doggod\My
Documents\My Videos\vidcap*"""
'WshShell.SendKeys " ""C:\Documents and Settings\doggod\My Documents
\My Videos\Archive\vidcap6pm"""
'WshShell.SendKeys "{ENTER}"
WshShell.SendKeys """C:\PROGRAM FILES\Dorgem\Dorgem.exe"""
WshShell.SendKeys "{ENTER}"
WScript.sleep 400
WshShell.SendKeys "exit"
WshShell.SendKeys "{ENTER}" Tag: script to add domain user to computers Tag: 214477
list of user permissions to shared folder
Hello all,
I need an advice or an example how to create a script generating report:
AD user - its permissions to a shred folder on a file server
for all AD users and all shares on my file server. There is possibly a tool
which can be used, but I cannot find it.
If somebody already bumped into such proble please let me know.
Thanks a lot,
-Alex Tag: script to add domain user to computers Tag: 214473
Script to distribute shortcut with error handling
Hello All.
Please can someone point me in the right direction
I am hoping to use a script that will connect to each pc listed in a
txt file and write to another txt file the pc's that were unreachable,
before copying a shortcut on the users desktop to the PC's that are
reachable.
This is crucial as I need to log the pc's that were not reached so
that I can push to them later.
I have placed the shortcut copying part in a subroutine and it has
tested fine.
Can someone advise me on the best way to test the connection for error
handling? In particular what would be best practice to connect to the
PC's in the ***MAKE CONNECTION*** section??? (WMI or ping???)
Any sample code would be appreciated.
******************************************************************
'Create a FileSystemObject
Set oFS = _
CreateObject("Scripting.FileSystemObject")
'Open a text file of computer names
'with one computer name per line
Set oTS = oFS.OpenTextFile("c:\computers.txt")
Set oTSOut = oFS.CreateTextFile("c:\errors.txt")
'go through the text file
Do Until oTS.AtEndOfStream
'get next computer
sComputer = oTS.ReadLine
On Error Resume Next
'***MAKE CONNECTION*** '
If Err <> 0 Then
oTSOut.WriteLine "Error on " & sComputer & _
":" & Err.Number & ", " & Err.Description
Else
On Error Goto 0
'***REST OF CODE HERE
'********************************************************************************************
Add_Shortcut
Sub Add_Shortcut
On Error Resume Next
Dim oFS, oWsh, oNetwork, strUser, Shell
Dim DesktopPath, link
Dim folder, file,
Set oWsh = CreateObject("WScript.Shell")
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
Set oNetwork= CreateObject("Wscript.Network")
Set Shell = CreateObject("WScript.Shell")
strUser = oNetwork.UserName
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\myshortcut.lnk") 'the
new shortcut name
link.TargetPath = "\\server1\share$\file.exe"
link.Save
End sub
'***********************************************************************************************
End If
Loop
oTS.Close
oTSOut.Close Tag: script to add domain user to computers Tag: 214472
win 2003 use wmi enable remote dekstop on firewall
'=D3=D2=BB=F7=CE=D2=B5=C4=B5=E7=C4=D4-->=CA=F4=D0=D4-->=D4=B6=B3=CC-->=C6=F4=
=D3=C3=D5=E2=CC=A8=BC=C6=CB=E3=BB=FA=C9=CF=B5=C4=D4=B6=B3=CC=D7=C0=C3=E6
Set objWMIService =3D GetObject("winmgmts:
{impersonationLevel=3Dimpersonate}\\.\root\cimv2")
Set colItems =3D objWMIService.ExecQuery("Select * from
Win32_TerminalServiceSetting")
For Each objItem in colItems
errResult =3D objItem.SetAllowTSConnections(1)
Next
'=D3=D2=BB=F7=B1=BE=B5=D8=C1=B4=BD=D3-->=CA=F4=D0=D4-->=B8=DF=BC=B6-->=C9=E8=
=D6=C3-->=C0=FD=CD=E2-->=D1=A1=D6=D0"=D4=B6=B3=CC=D7=C0=C3=E6"
Set objFirewall =3D CreateObject("HNetCfg.FwMgr")
Set objPolicy =3D objFirewall.LocalPolicy.CurrentProfile
Set colServices =3D objPolicy.Services
msgbox colServices.count
'=CE=C4=BC=FE=BA=CD=B4=F2=D3=A1=BB=FA=B9=B2=CF=ED
Set objService =3D colServices.Item(0)
objService.Enabled =3D False
'UPnP =BF=F2=BC=DC
Set objService =3D colServices.Item(1)
objService.Enabled =3D False
'=D4=B6=B3=CC=D7=C0=C3=E6
Set objService =3D colServices.Item(2)
objService.Enabled =3D True
'http://www.yongfa365.com Tag: script to add domain user to computers Tag: 214469
See what domain a computer belongs to!
Hi!
I'm looking for a script that tells me what domain a computer belogs to, the
script will be run remote.
I have found, or stolen, the following that tells me who is logged on to a
computer and it works fine. I'd like the other one to work in the same way.
ComputerName = InputBox("Enter the name of the computer you wish to query")
who = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set Users = GetObject( who ).InstancesOf ("Win32_ComputerSystem")
for each User in Users
MsgBox "The user name for the specified computer is: " & User.UserName
Next
Since I don't know anything about scripting, Iâ??m a copy and paste guy, even
this simple thing is pretty hard for me to solve.
Thanks for any help! Tag: script to add domain user to computers Tag: 214468
monitoring MTA Queues on exchange 5.5
I have to make a webapplication to monitor the queues of the exchange 5.5
from our company. I need to do this in VB (ASP) but I've no experiency in
this language because I'm a java programmer.
The code to display in asp will be no problem and I'm sure to succeed in
that. My problem is the connection to the exchangeserver in VB. I tried with
code below but got acces denied constantly.
Set objService = objLocator.ConnectServer(strComputer, "root\cimv2", strUser,
strPwd)
Set objService = objLocator.ConnectServer(strComputer, "root\DEFAULT",
strUser, strPwd)
We have a folder exchsrvr directly on the C:\ en in this folder there is the
folder MTADATA
Can someone help me starting up and making connection to the server. Which
objects do I have to get to monitor the MTA queues?
Thanks already
PS:Posted again because did not succeed first time aparently ?!
url:http://www.ureader.com/gp/1675-1.aspx Tag: script to add domain user to computers Tag: 214466
monitoring queues exchange MTA
I have to make a webapplication to monitor the queues of the exchange 5.5
from our company. I need to do this in VB (ASP) but I've no experiency in
this language because I'm a java programmer.
The code to display in asp will be no problem and I'm sure to succeed in
that. My problem is the connection to the exchangeserver in VB. I tried with
code below but got acces denied constantly.
Set objService = objLocator.ConnectServer(strComputer, "root\cimv2", strUser,
strPwd)
Set objService = objLocator.ConnectServer(strComputer, "root\DEFAULT",
strUser, strPwd)
We have a folder exchsrvr directly on the C:\ en in this folder there is the
folder MTADATA
Can someone help me starting up and making connection to the server. Which
objects do I have to get to monitor the MTA queues?
Thanks already
url:http://www.ureader.com/gp/1675-1.aspx Tag: script to add domain user to computers Tag: 214465
monitoring queues exchange MTA
I have to make a webapplication to monitor the queues of the exchange 5.5
from our company. I need to do this in VB (ASP) but I've no experiency in
this language because I'm a java programmer.
The code to display in asp will be no problem and I'm sure to succeed in
that. My problem is the connection to the exchangeserver in VB. I tried with
code below but got acces denied constantly.
Set objService = objLocator.ConnectServer(strComputer, "root\cimv2", strUser,
strPwd)
Set objService = objLocator.ConnectServer(strComputer, "root\DEFAULT",
strUser, strPwd)
We have a folder exchsrvr directly on the C:\ en in this folder there is the
folder MTADATA
Can someone help me starting up and making connection to the server. Which
objects do I have to get to monitor the MTA queues?
Thanks already
url:http://www.ureader.com/gp/1675-1.aspx Tag: script to add domain user to computers Tag: 214464
I encounter another "doesn't support this property or method" issus when calling a NetUnjoinDomain or NetJoinDomain API
Hi buddies,
My code is below, I run this script in Win2000 Pro SP4
It say that "doesn't support this property or method" --- NetUnjoinDomain \
NetJoinDomain
pls help me think about it :)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ReturnValue1 = objComputer.NetJoinDomain(Null, _
strDomain01, _
"OU=Computers,OU=CNLUC,OU=CN,DC=AD4,DC=AD,DC=Alcatel,DC=com", _
strDomain1 & "\" & strUser1, _
strPassword1, _
NETSETUP_JOIN_DOMAIN | NETSETUP_ACCT_CREATE)
Wscript.echo ReturnValue1 Tag: script to add domain user to computers Tag: 214458
Generating DateLastModified list throws errors
I have a text list of files (about 25k-30k) that are listed using their
absolute path with 1 per line. I wrote a vbscript that takes the list
of files, and one at a time, grab the DateLastModified value from each
one, and if that value is greater or equal to value returned by Date,
then it would right out the DateLastModifed value, a comma, and the
absolute path & filename. Example: 1/23/2008,
c:\somefolder\subfolder\anotherone\textfile.txt. Below is the code I
have written, but it throws an error (Invalid Procedure Call or Argument
800A00005) when accessing the DateLastModified property on the line
FileInfo(temp) = (fso.GetFile(FileToQuery(temp))).DateLastModified
Can anybody tell me where and how I messed up and what I can do to
correct it?
Dim FileName, fso, tempfile, lines, MaxCounter, FileToQuery, FileInfo,
Counter, FileToParse, FileToFind, temp
FileName = "c:\files_modified.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set tempFile = fso.getfile(FileName)
with tempFile.openastextstream(1)
.skip tempFile.size
lines = .line
End with
MaxCounter = lines
Dim FileToQuery(MaxCounter), FileInfo(MaxCounter)
Counter = 0
Set FileToParse = fso.OpenTextFile(FileName)
Do Until FileToParse.AtEndOfStream
FileToFind = FileToParse.ReadLine
FileToQuery(Counter) = Trim(FileToFind)
Counter = Counter + 1
Loop
FileToParse.Close
For temp = 0 To MaxCounter - 1
Next
Dim ObjStream
Const TristateFalse = 0
Const FILE_LOCATION = "C:\"
Const FILE_NAME = "updated_files.csv"
set objStream = FSO.CreateTextFile(FILE_LOCATION & FILE_NAME, True,
TristateFalse)
With ObjStream
For temp = 0 To MaxCounter -1 Tag: script to add domain user to computers Tag: 214456
get process open handles with wmi?
Hi all. I am wondering if its possible to use WMI to get a list of all
the handles an executable is using? An example of that function can be
seen in the object window of sysinternals process explorer. This would
allow me to see the name of all of the objects a particular process/
executable has open - stuff like reg keys, files, etc... Tag: script to add domain user to computers Tag: 214455
ActiveX Graph control in Access 2007
I am trying to include a graph (class graphslib) on a form and am having
trouble getting the data to show. Is there any way that I can get a copy of
the graphppr.hlp file so that I can do some research? Or is there a good
text that explains what is going on?
I'm running Office 2007 on a Vista OS.
The old msgraph control shows on the toolbar but is disabled. Tag: script to add domain user to computers Tag: 214448
Is there a script that will add a domain user to a list of computers on the
domain or not on domain as a local admin?
"tony" <tony@web.com> wrote in message
news:OB0190uYIHA.5132@TK2MSFTNGP02.phx.gbl...
> Is there a script that will add a domain user to a list of computers on
> the domain or not on domain as a local admin?
>