Limitations to WshShell.Run?
Can anyone tell me if there are limitations to length of characters
that WshShell.Run can handle. The reason I ask is that when I run a
script to CAb log files during the script I used a variable that
stores basically a list of files that meet a certain criteria of days
old and have no found out that if there are too many files listed it
apparently gives a permission denied error. SO I was just wondering
if there were any limitations on that and if so what they were.
Obviously there are some kind of limitations, because I change the
criteria of days to look for and have it find less files to put in the
list and it works fine.
Chris Tag: Adding users to a group Tag: 145557
Java won't reinstall
I had a bunch of parasites on my machine, tons of
unwanted popup ads, that Ad-Aware seems to have removed.
However, I had an error message at startup that Java (Sun
version) was missing a library and couldn't run. I
uninstalled Java, went back to Sun's website, and now it
won't reinstall. Any suggestions? Tag: Adding users to a group Tag: 145555
How to share a printer
Hello!
I want to share a local printer from a Terminal server session with a vbs
script.
Please help, I'm a real newbie to scripting.
Here is the part of my script that doesn't work... ;)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'PrinterName'")
For Each objPrinter in colInstalledPrinters
objPrinter.Shared = True
objPrinter.ShareName = Sharename
objPrinter.Put_
Next
I have the name of the printer in a variable and I want to put it in
'PrinterName' in ("Select * from Win32_Printer Where Name = 'PrinterName'")
I have a Win2003 box.
Many thanks.
Jesper Tag: Adding users to a group Tag: 145549
Help with File System Object
I am presently pulling information from a specific text file that has to be
on a floppy (don't ask why...I gave up asking why a long time ago).
The application takes the info from the file stores it in a session array
and all is good from there.
I'm trying to figure a 'nice' way of error trapping and alerting the user
that he hasn't put the disk in or that the file isn't there etc.
I have limited experience with the FileSystemObject so that's why I'm
turning here.
I'd like to alert the user that they have not yet put the disk in and not
let them go on until the correct disk with the correct file is in their
drive.
Anyone have any similar code or can point me in a good direction?
Pejo Tag: Adding users to a group Tag: 145544
wmi scriptomatic - run time error at line 90
Apologies for any cross posting.
I'm having trouble with scriptomatic on my XP Pro box.
I run "scriptomatic.hta" and get a very small window (title bar only)
and then get this error in a dialog:
Line: 90
Char: 4
Error: The object invoked has disconnect from its clients.
Code: 0
URL: file://C:\Documents and Settings\msabia\Local
Settings\Temp\scriptomatic.hta
Do you wan to continue running scripts on this page?
The window never becomes populated. If I maximize the window, I get
the 4 buttons but no pull down.
I've tried some of the other posted solutions for problems with
scriptomatic, but they don't seem to help.
I have no pop-up blocker running. It works fine on another XP Pro box
(which I don't have regular access to)
Any ideas?
Thank you!
Mike Sabia
(add a "2" to my email address for direct communication, if desired) Tag: Adding users to a group Tag: 145543
Hyper Link to script
All:
I have a Visio network diagram and I want to add a link to a VBS script.
I save the drawing as html, but wehen I click the link onb the web page,
it opens to a blank page.
Here is the address for the link: \\rwoca3\it_web\wscript
access_excel.vbs
Suggestions how to get this working?
--
Posted via http://dbforums.com Tag: Adding users to a group Tag: 145542
Script within script - nesting scripts
How do I invoke a vbscript from within a vbscript. For
example: I have Main.vbs, One.vbs, and Two.vbs. I would
like Main.vbs to invoke first One.vbs and then Two.vbs.
What's the right way to do this? Tag: Adding users to a group Tag: 145533
Getting info from a Registry Entry.
Hey People,
Here's the situation, I have made a VB script regarding some profile
relative settings on a client. However we thought it might be
interesting to get the script only to run if a surten entry on the
registry is 1.1 for instance.
so basically I made a key under HKCU/Software/Companyname/Profile "0"
So Default the key would be zero. Now when Im in the VB script I cant
seem to find a way to get that actual key into an IF construction.
so this is what I want: IF registryentry is 0 THEN Run script and at
the end create registry entry 1.1 (the creating an entry inst a
problem), and with that a line IF registryentry is 1.1 THEN stop te
script all together..
Can someone help me out here.. thnx in advance! Tag: Adding users to a group Tag: 145532
VBScript to search external LDAP
I am trying to write a VBScript that will search an external UNIX
directory based on a person's last name and first name.
I currently have a script that can search for the user's login id and
give me the first and last name:
--Begin Script--
CONST ADS_NO_AUTHENTICATION = &H0010
CONST ADS_SERVER_BIND = &H0200
sLDAPsrv = "ldap.server.edu"
sLDAPsb = "ou=people,o=server.edu"
sCN = InputBox("Enter UNIX ID:")
sRoot = "LDAP://" & sLDAPsrv & "/uid=" & sCN & "," & sLDAPsb
sDN = "cn=" & sCN & "," & sLDAPsb
Set oDSP = GetObject("LDAP:")
Set oUser = oDSP.OpenDSObject(sRoot,vbNullString,vbNullString,ADS_SERVER_BIND
AND ADS_NO_AUTHENTICATION)
oUser.GetInfo
strName = oUser.givenName
strLast = oUser.sn
MsgBox strName
MsgBox strLast
wscript.Quit
--End Script--
That works great, but I am unable to determine how to search for the
last and first name using the same methods and get the uid. I have
searched everywhere I can think, but most of what I find is either
exclusive to AD or exclusive to UNIX.
Help?
Thanks in advance,
Dan Tag: Adding users to a group Tag: 145530
IE Proxy setting script for a nOOb please!!
HELP I am new to the Win 2K server and need to set the proxy in the client
machines (XP). I have been doing it handraulically and it takes time and
dosnt set it for the users just the admin. I work volunteer in a small
school, my main work is electronics tech so I am in over my head. Please
help me...btw I am going back to school to learn networking so one day I
might be able help here.
TIA Michael Tag: Adding users to a group Tag: 145522
Script for Copying profile
Hello,
We created script to upgrade pc to winxp and automatically add it to new
domain, now we need to figure out how to copy old users profile to new one.
Any ideas ?
Thank you
Eimis Tag: Adding users to a group Tag: 145520
Capturing IE window content to text file
I have a web page that displays statistics which I would like to
periodically save. If I open the web page and hit CTRL+A to highlight the
text and then copy and paste it to a text document I get exactly what I
want. However, I would like to automate this with a vbscript. Can anyone
give me some idea of how to do this?
Thank you.
Ralph Tag: Adding users to a group Tag: 145519
Monitor Registry Entry Level Events
Hey all
Im trying to monitor a registry key HKEY_CURRENT_USER\Control Panel\Desktop
to find when a user is changing the wallpaper (win 2000 network).
Can someone tell me whats wrong with this script?
The script was taken from microsoft and modified to my needs.
1. can i monitor HKEY_CURRENT_USER???
2. the script is returns an error - "invalid query"
***********************************
Original script
Set wmiServices = GetObject("winmgmts:root/default")
Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
wmiServices.ExecNotificationQueryAsync wmiSink, _
"SELECT * FROM RegistryValueChangeEvent WHERE Hive='HKEY_LOCAL_MACHINE'
AND " & _
"KeyPath='SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion' AND
ValueName='CSDVersion'"
WScript.Echo "Listening for Registry Change Events..." & vbCrLf
While(1)
WScript.Sleep 1000
Wend
Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
WScript.Echo "Received Registry Change Event" & vbCrLf & _
"------------------------------" & vbCrLf & _
wmiObject.GetObjectText_()
End Sub
***********************************My script
Set wmiServices = GetObject("winmgmts:root/default")
Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
wmiServices.ExecNotificationQueryAsync wmiSink, _
"SELECT * FROM RegistryValueChangeEvent WHERE Hive='HKEY_CURRENT_USER'
AND " & _
"KeyPath='Control Panel\\Desktop' AND ValueName='Wallpaper'"
WScript.Echo "Listening for Registry Change Events..." & vbCrLf
While(1)
WScript.Sleep 1000
Wend
Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
WScript.Echo "Received Registry Change Event" & vbCrLf & _
"------------------------------" & vbCrLf & _
wmiObject.GetObjectText_()
End Sub
*********************************** Thanks,
ITman Tag: Adding users to a group Tag: 145516
RUN/execute a Command-Line command from an ASP page.
Hi,
I need to RUN/execute a Command-Line command from an ASP page.
This is the command:
sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2 -p
Can you show me a code how to run this command from an ASP page? I need to
run it from an ASP/VBscript?
Thank you very much for your help! Tag: Adding users to a group Tag: 145513
Select variable "column name"
I'm having this code in VBscript and I want to select a column name
which is variable.
<%@Language="VBScript"%>
<%
Link = Request.QueryString("link")
oRS.Open "SELECT 'Link' FROM snowzone", oConn, 2, 3
%>
How should the SELECT statement be written correctly? Tag: Adding users to a group Tag: 145510
Spaces and parameters query for VB Script
Hi all -
I need to run an application off a shared network drive. I am
having problems with writing the script that will access the network
drive (since I need to specify parameters and the network drive name
has a space in it). I have no problems running it off the command
line, but with the spaces and quotes in VBScript, things get messed
up.
I need to run this line with VB Script, anyone with any ideas ?
(All on one line)
\\Software share\Clients\W32Intel\Setup.exe -s -f1
\\Software share\Clients\W32Intel\setup.iss"
I'm looking for something like this :
set ws = wscript.createobject("wscript.shell")
ws.run("\\Software share\Clients\W32Intel\Setup.exe -s -f1 ... etc")
I have tried several combinations of """, "", and " with no luck :-)
Thanks for your help. Tag: Adding users to a group Tag: 145497
CDONTS - What happens to bad mail?
When you use CDONTS to send mail through an active server
page... what happens to the email if the email address is
bad.
Is there a way to capture the bad email address and
forward it somewhere so we can tell the email was returned? Tag: Adding users to a group Tag: 145491
msgbox alternative IE window
Hello,
How can I display a custom dialog using IE with 2 or 3 buttons?
I need to output the html code from running script including the input
buttons.
Schematic example:
<HTML>
"This is what happened, do you want to proceed?"
<form>
<input buttons YES NO CANCEL>
</form>
</HTML>(please ignore the bad syntax)
I want to loop the IE window function until the user clicks the button.
Then I want the button clicked value returned back to the script where I can
perform other actions based on the clicked button value.
If I have to pre-output the HTML file, this is acceptable but on the fly
output solution would be much better.
Many thanks,
Dave Tag: Adding users to a group Tag: 145480
How to found out the local printer to connect or not
Does anyone know how to check whether the local printer
is attach to a workstation or not using vb script or WMI ?
The workstation (w2000) may have boths the network
printer and a local printer attach or just the network
printer. The Printer Driver(local/network) may be install
already, but the local printer may have remote from the
workstation, so check the driver exist or not is not a
good idea.
Thanks! Tag: Adding users to a group Tag: 145478
default printer
Hi there
I use this code to set the default printer
Dim WSHNetwork
set wshnetwork = createobject("wscript.network")
on error resume next
WshNetwork.SetDefaultPrinter "\\server\hp1"
if err<>0 Then
wshNetwork.AddWindowsPrinterConnection "\\server\hp1"
WshNetwork.SetDefaultPrinter \\server\hp1
End if
it works fine for all my win2000 pro and XP pro computers. But not on the
NT4 worksstation. it's the SetDefaultPrinter that fails.
any good ideas?
Thanks
Brian Tag: Adding users to a group Tag: 145473
How To: Disable Selections with OnSelectStart
I have observed several samples in JavaScript such as:
<BODY onselectstart="return false">
But, I am having troubles in VBScript. I want to avoid mixing Java and
VBScript in this page so as not to have to load both scripting engines.
Anyone been able to successfully do this? Thanks
-Tom Tag: Adding users to a group Tag: 145468
Oct 31st-Nov 14th - Totaldicks Rock Tokyo - check WindowsMedia d1fV3tvLw
Totaldicks (aka Total Dicks) starring Anand Bhatt and James Buban of the popular tribal hardcore group Anand clique are in Tokyo this October 31st thru November 15th 2003.
rvGKu69 Tag: Adding users to a group Tag: 145467
Externally Reading a Form Input Field
I am trying to consistently read a hidden Input field in a
Form located in a HTML that was opened with the
objExplorer.Navigate statement. Sometimes I can read the
field after the Submit button is clicked, sometimes I
can't and I get the error: "Object doesn't support this
property or method: 'myForm'"
Here is the VB script statement (external to the HTML
file):
Do While TRUE
strTemp = objDocument.myForm.bWaiting.value
If strTemp <> "TRUE" Then
Exit Do
End If
Loop
Help.......... Thanks in advance.
Russell-S
Russell-S Tag: Adding users to a group Tag: 145463
WMI call for files in a specific folder not modified in the past 7 days?
Hello all
I'm writting a script that renames files on a daily basis, and I want
to delete any files (in a specific folder) that have not been modified
in the past seven days.
I'm thinking that the query string should look like this:
Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile _
where LastModified < convert(datetime,'10/21/03 21:00:00')")
but I don't seem to get anything back. If someone knows how I can fix
this, it would be greatly appreciated. I can't seem to find anything
on the Internet that addresses this issue.
any help is greatly appreciated!
--Gene Tag: Adding users to a group Tag: 145462
Vbs populate ie web form with frames
Hello,
We have a website on our intranet that has frames and text boxes that
we need to populate with data automatically with VBScript. I have
been able to populate other web pages with VBScript when they don't
have frames, but cannot figure out how to populate them when they have
frames.
I have been trying to search the existing posts, but I still can't
seem to get this to work.
I found a website on the Internet that has frames and input boxes that
are similar to our intranet web page.
http://www.iopus.com/iim/demo/frames
Does anybody know how I could use VBScript to populate these text
boxes within the frames? This is the code I have figured out so far:
Const URL = "http://www.iopus.com/iim/demo/frames"
With WScript.CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate URL
Do Until .ReadyState = 4
WScript.Sleep 50 ' wait for page to load
Loop
With .document.forms(1) ' I DON'T KNOW WHAT ELSE GOES HERE TO
REFERENCE TO FRAME
.T1.value = "Hello" ' enter company into a textbox
End With
Would anybody be willing to show me what I am missing in my code?
Thank you in advance,
Shawn Tag: Adding users to a group Tag: 145455
QUESTION ON SESSION VARIABLES
Hi there....
i got a quick one for you guys. i've this session variable that is
updated by calling a server method (i set this value when the user
hits a submit button in my form. The server method is called when i
load all my asp forms.). I'd like to be able to update this session
variable, without being forced to submit my form or refresh my form
(something that will call my server method each 2 min lets say,
without refreshing my page or submit)...is there anyway to do this???
Maybe a remote scripting with the setinterval() method?? but i'm
having trouble using this with XP and IE 6 !!
Your help is with this matter is higly appreciated!! Tag: Adding users to a group Tag: 145449
adding and deleting printers
Ok I'm trying to get my scripts to work and it's just not. I do have the
one for adding a printer working but for deleting is a different story.
Here is my adding a printer script. (It works)
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\tpl\plu1"
WshNetwork.SetDefaultPrinter "\\tpl\plu1"
Here is my deleting script.
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.RemovePrinterConnection "\\tpl\plu1"
The deleting script runs with no errors but the printer stays. What I would
like to do is use the add printer script as logon scripts so that when a
user logs on they get the correct printer. If I don't have a deleting
printer script run as a log off script will it screw up the next time the
user logs on and keep adding printers and does anyone know why my deleting
printer script doens't work? I run all W2k boxes. Tag: Adding users to a group Tag: 145447
Service like script
Hi
I am sure its been asked many many times, but is there a way of creating a
script that runs from time to time, say every 5 mins that can check to see
if a certain time has elapsed and then send an email.
Basically, I want to build a reminder system into my intranet that checks a
calendar database and 1 hour or 1 day before sends out a reminder email.
Almost like a service.
Anyone any ideas as to where i look?
MC Tag: Adding users to a group Tag: 145446
getting cell values from excel
I am needing to open an excel document, and extract the
values from column A of an excel document.
For example: I have an excel document that someone else
made with over 1900 rows. The data in each cell contains a
link to a file in the directory that the spreadsheet is
in. Each time you click on one of the cells you can see
the hyperlink data above in the cell property box.
How can I, with vbscript, open the worksheet and extract
the values from all cells in column A?
Thanks for any help. Tag: Adding users to a group Tag: 145443
Setting printer destination with VB/Crystal on XP OS
Hello all,
I'm using VBA in Great Plains v6to call & print a v8
Crystal report to an Epson
LQ-870 ESCP2 printer. The code (very simple, I have to
admit) is below. It's
worked fine in Windows 95 for years but as soon as I
install XP and try it I get the
message 'Invalid Printer Specified.' I understand Windows
XP uses a universal driver
called UNIDRV.dll. Is that what's causing the problem?
If so, does anyone have
any idea how to get around it? I've a few things with no
success? I need help!
Thanks,
Don
The code:
' Save document
'SalesTransactionEntry.Save = 1
' Set report file name.. should be located in the
dynamics directory
PickingTicket.ReportFileName = "PickingTicket.rpt"
' Tell Crystal reports to discard any saved data
PickingTicket.DiscardSavedData = True
' Turn off progress dialog box
PickingTicket.ProgressDialog = True
' Set report destination
PickingTicket.Destination = crptToPrinter
PickingTicket.PrinterDriver
= "ESCP2MS.DRV" 'UNIDRV.dll ??
PickingTicket.PrinterName = "Epson LQ-870 ESC/P 2"
PickingTicket.PrinterPort = "LPT1"
' Print report.
PickingTicket.Action = 1 Tag: Adding users to a group Tag: 145436
Configuering Internet Settings for remote machines
Hi All,
I would like to have a vb script which configures the Internet
settings for Remote machines.I have a script which does for local
machine.That script is using "wscript.shell".I dont know if this can
be used to alter the settings of remote machines.Pls give me a script
or tell me how to use the above mentioned method for remote
machines.Your responses will be highly appreciated.
Thanks
Gaurav Tag: Adding users to a group Tag: 145435
Configuering Internet Settings for remote machines
Hi All,
I would like to have a vb script which configures the Internet
settings for Remote machines.I have a script which does for local
machine.That script is using "wscript.shell".I dont know if this can
be used to alter the settings of remote machines.Pls give me a script
or tell me how to use the above mentioned method for remote
machines.Your responses will be highly appreciated.
Thanks
Gaurav Tag: Adding users to a group Tag: 145432
Create a folder on a remote server
create a folder on a remote server?
how do I do this,
The only script examples I can find, create a folder on the local machine
only.
TIA Tag: Adding users to a group Tag: 145430
script scheduling in AD environment?
Okay Folks:
Sir twitch a lot here is going bonkers yet again. Here is this little
script I pulled out of the Microsoft Windows 2000 scripting guide.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.shutdown()
Next
Fine, fire this vbs puppy up and pooft, the computer shuts off. Which is
exactly what I wanted. Now what I want to do is schedule this puppy via
organizational units to apply to certain machines. Problem is that we have
a bunch of users who love to leave their computers on all night, burn out
monitors and occasionally fry their computers because of electrical
activities in the area. Okay, so I figured that a nice .bat file along the
lines of this
at.exe 21:00 every:m,t,w,th,f,s,su \\servername\sharename\shutdown.vbs
I figure this would solve the problem but it's a bit cumbersome. Does
anybody know of a way to incorporate the equivalent of an "AT" command that
would fire up at the computer startup so that the machine would know that,
hey, I need to shut myself down at XX:XX hours. The best thing to do,
ultimately, and I likely have a script for it somewhere, is that the
machines would magically turn themselves up.
I am shooting here for something that will work on the organizational unit
level, any suggestions, comments or prayers???
Regards,
Walt Tag: Adding users to a group Tag: 145420
Form Sleep
I have been searching for an answer to the problem I've
been having with a form. I have an HTML file that I load
via a VBScript that is being used to copy CDs to a network
drive. The user will enter the year and the CD number in
the form. Then VBScript creates a folder based on the
information entered and copies the CD to it.
The problem I'm having is that when the Submit button is
clicked the only way I could get the calling VBScript to
take over is to put a MsgBox in the HTML's script area. I
dont mind that except that I would like to have the dialog
box close automatically. I can't use the PopUp function
since IE's security complains. I tried using a For/Next
but that didn't help. What can I do to avoid the MsgBox.
Shown below are snippets from the HTML and VBS files.
Thanks for your help.
===================================================
HTML File (Form section):
===================================================
<form action="" onsubmit="vbscript: CopyDisk()"
method="POST" border="0" width="100%" id="MyForm"
name="MyForm">
<input type="hidden" name="bWaiting" value="TRUE">
<table border="0" width="100%"
<td width="60"> Enter the Year here: <input
type="text" name="Year" id="Year" maxlength="4" size="4"
onkeypress='validate(Me)'</td>
<br>
<td width="860">Enter the CD Number here:
<input type="text" name="CDInfo1" id="CDInfo1"
maxlength="8" size="8" onkeypress='validate(Me)'
===================================================
HTML File (VBS section):
===================================================
<SCRIPT language="VBScript">
Sub CopyDisk()
MyForm.bWaiting.value = "FALSE"
If Len( MyForm.Year.value ) > 0 AND Len(
MyForm.CDInfo1.value ) > 0 Then
MsgBox "Now copying the CD. Please wait for the ""Copy
completed...."" message before clicking OK below."
Else
ExitNow()
End If
End Sub
Sub ExitNow()
MyForm.bWaiting.value = "WAIT"
If MsgBox( "Are You Exiting the Input Window?",
(vbQuestion + vbYesNo), "Exit Information" ) = vbNo Then
MyForm.bWaiting.value = "TRUE"
Else
MyForm.bWaiting.value = "FALSE"
End If
End Sub
</SCRIPT>
===================================================
VBS File:
===================================================
Do While NOT (objExplorer.Busy)
Loop
strYear = objDocument.myForm.Year.value
strCDNo = objDocument.myForm.CDInfo1.value
objExplorer.Visible = 0
If Len( strYear ) = 0 OR Len( strCDNo ) = 0 Then
Do Until objDocument.myForm.bWaiting.value <> "WAIT"
wScript.Sleep 750
Loop
If objDocument.myForm.bWaiting.value = "FALSE" Then
Exit Do
ElseIf objDocument.myForm.bWaiting.value = "WAIT" Then
wScript.Sleep 500
objDocument.myForm.bWaiting.value = "TRUE"
End If
Else
On Error Resume Next
strTarget = CNST_RCV_FLDR & "CD" & strYear & "_" &
strCDNo
If NOT objF_Sys.FolderExists( strTarget ) Then
objF_Sys.CreateFolder strTarget
....... Tag: Adding users to a group Tag: 145417
Error Expected End
Get Expected "End" error in vb script on last line Char: 8 does anyone
know why?
Thanks!
Glenn
***************************************************************************
Dim wshShell, wshNetwork, OS_Ver, CRLF, oFSO, hoFSO, GroupDict,
CCMINSTPATH
CRLF = Chr(13) & Chr(10) ' use for return and line carriage
Set wshNetwork = WScript.CreateObject("WScript.Network")
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
TempPath = wshShell.ExpandEnvironmentStrings("%TEMP%")
UserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")
ComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set WshShell = Wscript.CreateObject("Wscript.Shell")
strMapperSetting = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5FF8D3B8-E19A-4B74-A430-A5366CA74B3F}\InstallSource")
if strMapperSetting = "\\ccl_applib\msipackages\mapper\" then
message = "value exists"
If oFSO.FileExists(".\dataexist.010") then
oFSO.DeleteFile(".\dataexist.010")
End if
If Err.Number <> 0 Then ' value does not exists
strMapperSettingExists = 0
Else
strMapperSettingExists = 1
End If
if strMapperSettingExists = 1 then
writelog message
end if
wscript.quit
'===================================================================================
'***************************** Subroutine to write to file
*************************
'===================================================================================
Sub WriteLog (strMessage)
const ForRead = 1
const ForWrite = 2
const ForAppend = 8
LogFile = ".\dataexist.010"
Set fsLog = oFSO.OpenTextFile(LogFile, 8, True)
fsLog.WriteLine (strMessage)
fsLog.Close
end sub Tag: Adding users to a group Tag: 145414
status of remote machine.
All,
I am looping thorugh the computer objects in a Domain. Within the loop I
need to bind to each maching and read the registry. I would like to discern
the status of the remote machine before attempting to bind to it. Does
anyone have any suggestions?
I am assuming that the IADS computerstatus can't be used based on previous
posts. If this works can someone point me toward an example?
Otherwise any suggestions would help.
Thanks in advance
PO Tag: Adding users to a group Tag: 145410
Move and Delete Scripting Help
how do I move files from a folder to another folder, and
then the other thing is how do I delete the files after
they have been moved, of course I only want to delete the
files that arte older than 7 days. Here is some script,
but for some reason it is not doing what I need it to do.
It does nothing: I have included the scripts in text
below, didn't know if anyone could possibly point me in
the correct direction:
Move Files:
Const FOF_CREATEPROGRESSDLG = &H0&
TargetFolder = "C:\Move"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TargetFolder)
objFolder.MoveHere "C:\logfiles", FOF_CREATEPROGRESSDLG
Delete files: (Yes I know I have to add a way to check if
they are older than 7 days, but I was just testing to make
sure it worked before I added that in there, and so far
nothing)
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\logfiles\*.log"), DeleteReadOnly Tag: Adding users to a group Tag: 145408
ipconfig /flushdns
I need a vbs script to run ipconfig /flushdns everytime user logs in or
computer boots up.
Thank you very much!
Eimis Tag: Adding users to a group Tag: 145406
How do you check the current CURSOR TYPE (not in IE)?
Hi everyone,
I did a lot of google searches, and came up with nothing. Most of the
links were related to changing the cursor type in IE, or getting the
Cursor handle in VB.
I was wondering if anyone knew a way of getting the current cursor type;
I am checking to see if it's an hourglass.
Reason:
I am using keyboard shortcuts to save to a file in an Application, and I
am loading the saved file in an XMLDOM, but I can't do that till it's
been saved.
Monitoring file creation requires a separate thread; I thought it would
be easier to check whether the current cursor is an hourglass.
A solution would be much appreciated...
Thank you
--
Posted via http://dbforums.com Tag: Adding users to a group Tag: 145405
Functions calling Functions
We switch database vendors without changing every .asp
page of a web by calling a custom VBScript function. The
function takes the specific database name as its single
arguement and returns a complete OLE connection string for
that database. Thus, a single file (the function) only
needs editing to switch from one database (eg SQL Server)
to another (eg: ORACLE).
Other VBScript custom functions in the web also require
database connection(s). How do they use the same function
to create their connection string(s)?
Example:
In the .asp we have ...
<!-- #include file = ../functions/dboledb.inc -->
<%
'Script:
Dim cnnActive
Dim strOLEDB
...
Set cnnActive = Server.CreateObject ("ADODB.Connection")
strOLEDB = OLEDBString("Active")
cnnActive.Open strOLEDB
...
%>
Here's the function:
<%
Function OLEDBString(strDB)
'>>>
'>>> Create the OLEDB connection string for the customer
database
'>>> Here, use the Microsoft Access JET OLEDB v4
'>>>
'Create the link with the [strDB] database
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;"
OLEDBString = OLEDBString & "Data
Source=C:\InetPub\wwwroot\VManager\databases\"
OLEDBString = OLEDBString & strDB & ".mdb;"
OLEDBString = OLEDBString & "User ID=admin; Password=;"
End Function
%> Tag: Adding users to a group Tag: 145404
mapnetworkdrive problem
I am using the mapnetworkdrive method to map drives for users during logon.
I changed a drive mapping for a user and it is mapping to the new location
but the windows explorer name shows the old path. When you look at the
properties or try and disconnect the drive it does give you the correct NEW
path but the explorer view has the old path listed. The user has rebooted
and still no luck. Is there some way to refresh the name when changin the
path to a mapped network drive. Tag: Adding users to a group Tag: 145402
Outllook Macro warning and one-off forms...
I have an Outlook folder full of contacts that use a custom contact form.
One of these items occasionally becomes one-offed.
I have a VBscript that loops through all the contacts and does some
processing. When it attempts to access the contact via code similiar to this
For each thing in Directory.Items
temp = thing.homeaddress
NOTE: I don't ever actually open the item I'm looking at, I just use the
Thing.fieldname notation to access the data.
I get the "Do you wish to enable macros" dialog box. This causes my script
to just sit there until someone hits yes or no (Which might take days).
So I need a workaround that would allow my script to run un-attended.
1) Is there anyway to supress the enable macros dialog box for one-offed
items?
2) Is there anyway to open an item with its macros disabled?
3) Can I check the messageclass of an item without trigging the dialog box?
Any help would be much appreciated!
-J Tag: Adding users to a group Tag: 145398
Progres window
Hi,
I am using oShell.run command_line,0,true but I want to display possibly a
IE progress window while the command line is running so i'm thinking I can
do something like:
Do until return = 0
IE progress window (how?)
return = oShell.run command_line,0,true
Loop
I can see two problems with the above: I'm thinking that return = oShell.run
command_line,0,true will not execute until the IE progress window is running
and I also don't know how to invoke the progress window. Could someone
direct me to online info about using progress windows while some process is
running? I would also appreciate a code example or better approach if not
too much trouble.
Thank you,
Dave Tag: Adding users to a group Tag: 145395
Check CD-R disk status
Hello,
Can someone tell me how to check if a blank unformatted CD-R is present in
the drive and if not blank then if there are any files written on it?
I tried checking readiness using IsReady and checking presence of any data
by counting files in drive_letter:\ but I have a catch 22 situation:
If the disk is blank drive returns NOT READY and if I check for written
data, because drive is not ready (for blank disks) script gives me an error
CANNOT FIND PATH when trying to count files.
Basically what I want to do is:
Step 1: check if CD drive is ready, i.e. if a CD is physically there
regardless of it's status or formatted state
Step 2: if the drive is ready, check for presence of any data, even if the
disk is unformatted without returning error because it's unformatted.
Or just simply check if the drive definately contains unformatted and blank,
out of the box CD-R - just this will suffice if this is possible.
Thanks you,
Dave Tag: Adding users to a group Tag: 145393
ADSI on IIS not the same as PWS
Please take a look at the following code:
Sub test()
Dim usr
Dim grp
' This part is working in Excel, Personal web server and
IIS (4 and 5)
Set usr = GetObject
("WinNT://valid_domain/valid_user ,user")
For Each grp In usr.Groups
Debug.Print grp.Name
Next
' This part is working in Excel and Personal web server
but not on and IIS (4 and 5)
Set grp = GetObject
("WinNT://valid_domain/valid_group,group")
For Each usr In grp.Members
Debug.Print usr.Name
Next
End Sub
I have tried this code on Excel and Personal web server
without any problem. But when I try to run it as ASP page
on IIS (4 and 5) I can get all the use details, but not
the group details. The grp.Members is always empty. Does
anyone know why this is not working? Tag: Adding users to a group Tag: 145392
Computer Last Logon
I have the following vbscript that returns the user's last logon.
Can it be modifyed to return the Computer's last logon?
Thanks in advance.
==================================
Dim User
user = InputBox("Enter user ID","Last Logon")
'msgbox user
Set wshArguments = WScript.Arguments
set objUser = GetObject("LDAP://" & "CN=" & User &
",OU=USERS,OU=TPA,OU=USA,DC=domain,DC=com")
str1 = "Last Login: " & objUser.LastLogin
MsgBox str1 Tag: Adding users to a group Tag: 145391
Change drive volume label/name
Hello,
Does anyone know how to change volume label/name of a floppy or a zip disk?
Many thanks,
Dave Tag: Adding users to a group Tag: 145388
getting info in word about box.
I'am looking for a way to get the version of word that is displayed in it's
about box. Can't seem to find it in the registry, so it mught be embedded in
the .exe. Currently it displays as:
Microsoft Word 2000 (9.0.6926 SP-3).
Thanks
Andres Tag: Adding users to a group Tag: 145386
Is there a way to add all users in a particular OU to a ditribution list
using a script... any help would be appreciated.