Launch a Microsoft Access Macro
Hi....Is there a way to automatically launch a Microsoft Access 97
Macro using vb script. Any help would be greatly appreciated.
Thanks!!! Tag: Help - How to display system time (continuously updating) on page complete Tag: 172619
Ldap property
Hi ,
I'm developing a vbs program that access to a Active Directory.
I'm getting an object and I want to know if the property value is null or
have a value
What I'm doing is the next
While Not objRecordSet.EOF
strMsExchHomeServerName = objRecordSet.Fields.Item("msExchHomeServerName")
if err.number <> 0 then
hasmb = false
else
WriteLog logfile, "msExchHomeServerName = " & strMsExchHomeServerName
End if
wend
Always returns code = 0.
Please, help me
Thank in advance
olivarbudia Tag: Help - How to display system time (continuously updating) on page complete Tag: 172618
using vbscript to transfer/move files
I'm looking for some code example on how to move a folder/file from one
server to another inside the same domain. I have code to move a folder from
on location to another on the same server, but when I try to move a
folder/file from one server to another, I get a permission denied error. Any
help would be greatly appreciated.
Ron Tag: Help - How to display system time (continuously updating) on page complete Tag: 172616
A couple of questions about VBScript
I've got a couple of questions WRT VBScript. I am using VBScript with
Windows Script Host on Windows XP and incorporating the scripts into a WSF
file.
My questions are as follows:
1. Do classes allow for public or private Const declarations? I've tried,
but I can't seem to find a way to do this. I have been able to duplicate
the behavior by using properties with only a Get accessor, but this seems to
be a bit of a hack. I have several constants that are only needed internal
to the class and several that are helpful as arguments to methods. The
amount of code needed for the property hack seems wasteful and the
initialization of private data members is cumbersome.
2. Does VBScript allow Enums? The documentation doesn't appear to disallow
it, but I am unable to code them without getting a runtime error. I've
likely missed something in the documentation, but I thought that I would
ask.
3. Is it possible to have some sort of class constructor that takes an
argument as opposed to Class_Initialize which does not allow arguments? I
have several classes where it makes sense to only have single step
contruction as the class is in an indeterminate state unless several
properties are known at class instantiation time. Two-step construction
would require the user of the classes to know that the second method call is
required.
Thanks in advance..
-Pete Tag: Help - How to display system time (continuously updating) on page complete Tag: 172611
IExplore.exe
Below is a vb script that will destroy any Iexplore.exe processes. It works
fine but is there a way to determine which ones not destroy.
For example, lets say the following websites are currently open.
www.google.com
www.yahoo.com
www.microsoft.com
Is there a way to destory yahoo and google but leave the microsft site open.
We have a webapplication that is menu enabaled that launches several
websites. I want to be able to see if a website is open before intiaiting
another instance.
strWMIMoniker = "winmgmts:!//posdtdc357407b"
strQuery = "select * from Win32_Process where Name='iexplore.exe'"
WScript.Echo(strQuery)
For Each wmiProcess in GetObject(strWMIMoniker).ExecQuery(strQuery)
WScript.Echo wmiProcess.Name & " (" & wmiProcess.ProcessId & ") is being
terminated"
wmiProcess.Terminate
Next Tag: Help - How to display system time (continuously updating) on page complete Tag: 172609
Enable / Disable 802.1x with some script
Hi everyone,
I have been searching the answer to my question for a very long time now,
but there is no solution in sight. So here is my problem:
I want to enable / disable 802.1x Authentication on network adaptors using
some sort of automation (some script / program). Does anyone out there knows
a solution for that?
I'll highly appreciate any helpful suggestions or pointers. Thanks in
Advance.
T. Shafi Tag: Help - How to display system time (continuously updating) on page complete Tag: 172601
Editing the nth byte of a BINARY Registry Value
Hello
I'm trying to edit a Binary Registry value which I can do by doing a full
replace of the data, but because the data could be different from machine to
machine and only specific bytes change I was trying to write a script that
would allow me just edit specific bytes for example byte 6 and 63, but I
don't know the best way to go about it.
Could I use to the Replace function in this example?
Replace(reg_string, "00", "01", 63, 1, 0)
If so would someone be able be able to help me read in a binary registry
value that I could run the replace on.
I really don't have any preference how I get to how I get this to work, my
programming knowledge is limited so any advice or help would be most
appreciated.
Thanks for time
Gary
PS My reference to a byte is if you export out from the registery a binary
value
eg "1"=hex:03,00,00,00,00,00,00,
I'm asuming that the number inbetween the coma's represets a byte and I've
worked out byte's that I would need to change.
Please feel free to tell me if i'm being a doughnut Tag: Help - How to display system time (continuously updating) on page complete Tag: 172598
Scripting for local user admin
I am looking for a script that I can run that will search
all computers in my windows 2000 domain, display the
username logged on and see if that user has local admin
rights to his local machine
Any help?
Thanks Tag: Help - How to display system time (continuously updating) on page complete Tag: 172595
Removing "File Extension Assoication"
Hi all,
I wonder if anyone knows how to remove a "file extension assoication"
programmatically with VBScript/WSH/WMI or maybe simply with a ".reg" file?
Thanks in advance.
T. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172593
same script ok on 2K but return nothing on NT4
This is a multi-part message in MIME format.
------=_NextPart_000_0029_01C5394E.45CFB640
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have the vbscript abstract to query installed software information =
from registry, the script runs perfect on Win2k/2k3, however returns =
nothing on NT4, even though I have already installed WMIcore for NT4. =
There is no error msgs, the output file is still created, but no =
installed software is enumerated.
I checked NT registry and it seems the software list is in the same =
location =
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"=
, the users account used to run the script is under administrators =
group.=20
Any ideas?=20
Thanks
Frank
This is part of the script:
-------------------------------------------------------------------------=
-------------------------------------------------------------------------=
--
' To enumarate installed software from the reg key which will also =
appear on add/remove programs
' to enumurate the UninstPath for subkeys using EnumKey method,=20
' then Get correponding value from the key Path using GetStringValue =
method for string keys
' In order to remove invalid output, check the display name of the reg =
key is not Null.
' Then check the version and Installed date which if null set to empty =
so that output correctly
Const HKEY_LOCAL_MACHINE =3D &H80000002
Const UnInstPath =3D =
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set objReg=3DGetObject("winmgmts:{impersonationLevel=3Dimpersonate}!\\" =
& _
strComputer & "\root\default:StdRegProv")
objReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys
objFile.WriteLine ()
objFile.Writeline("-------------------Installed Software =
Information------------------------")
For Each subkey In arrSubKeys
strKeyPath =3D UnInstPath & "\" & subkey
objReg.GetStringValue =
HKEY_LOCAL_MACHINE,strKeyPath,"DisplayName",strValueDisplayName
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath , =
"DisplayVersion",strValueDisplayVersion
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath , =
"InstallDate",strValueInstallDate
If Not IsNull(strValueDisplayName) Then
strSoftwareName =3D strValueDisplayName
End If
If Not IsNull(strValueDisplayVersion) Then
strSoftwareVersion =3D strValueDisplayVersion
Else=20
strSoftwareVersion =3D Empty=20
End If
If Not IsNull(strValueInstallDate) Then
strSoftwareInstallDate =3D "Installed on " & =
WMIDateStringToDate1(strValueInstallDate)
Else
strSoftwareInstallDate =3D Empty
End If
If Not IsNull(strValueDisplayName) Then
objFile.WriteLine(strSoftwareName & " " & strSoftwareVersion & " " =
&strSoftwareInstallDate)
End If
------=_NextPart_000_0029_01C5394E.45CFB640
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.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV> </DIV>
<DIV>I have the vbscript abstract to query installed software =
information from=20
registry, the script runs perfect on Win2k/2k3, however returns nothing =
on NT4,=20
even though I have already installed WMIcore for NT4. There is no error =
msgs,=20
the output file is still created, but no installed software is =
enumerated.</DIV>
<DIV> </DIV>
<DIV>I checked NT registry and it seems the software list is in the same =
location=20
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"=
, the=20
users account used to run the script is under administrators group. =
</DIV>
<DIV> </DIV>
<DIV>Any ideas? </DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>Frank</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>This is part of the script:</DIV>
<DIV>--------------------------------------------------------------------=
-------------------------------------------------------------------------=
-------</DIV>
<DIV><FONT face=3DArial size=3D2>' To enumarate installed software from =
the reg key=20
which will also appear on add/remove programs<BR> ' to enumurate =
the=20
UninstPath for subkeys using EnumKey method, <BR> ' then Get =
correponding=20
value from the key Path using GetStringValue method for string =
keys<BR> '=20
In order to remove invalid output, check the display name of the reg key =
is not=20
Null.<BR> ' Then check the version and Installed date which if null =
set to=20
empty so that output correctly</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR> Const HKEY_LOCAL_MACHINE =3D=20
&H80000002<BR> Const UnInstPath =3D=20
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"<BR> Set=20
objReg=3DGetObject("winmgmts:{impersonationLevel=3Dimpersonate}!\\" =
&=20
_<BR> strComputer &=20
"\root\default:StdRegProv")<BR> objReg.EnumKey HKEY_LOCAL_MACHINE,=20
UnInstPath, arrSubKeys<BR> objFile.WriteLine=20
()<BR> objFile.Writeline("-------------------Installed Software=20
Information------------------------")<BR> For Each subkey In=20
arrSubKeys<BR> strKeyPath =3D UnInstPath & "\" =
&=20
subkey<BR> objReg.GetStringValue=20
HKEY_LOCAL_MACHINE,strKeyPath,"DisplayName",strValueDisplayName<BR> =
=20
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath ,=20
"DisplayVersion",strValueDisplayVersion<BR> =20
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath ,=20
"InstallDate",strValueInstallDate<BR> If =
Not=20
IsNull(strValueDisplayName) =
Then<BR> strSoftwareName =3D=20
strValueDisplayName<BR> End If<BR> If =
Not=20
IsNull(strValueDisplayVersion)=20
Then<BR> strSoftwareVersion =3D=20
strValueDisplayVersion<BR> Else=20
<BR> strSoftwareVersion =3D=20
Empty <BR> End If<BR> If Not=20
IsNull(strValueInstallDate)=20
Then<BR> strSoftwareInstallDate =3D "Installed on =
" &=20
WMIDateStringToDate1(strValueInstallDate)<BR> Else<BR>&n=
bsp; strSoftwareInstallDate=20
=3D Empty<BR> End If<BR> =
If Not=20
IsNull(strValueDisplayName)=20
Then<BR> objFile.WriteLine(strSoftwareName & =
" "=20
& strSoftwareVersion & " "=20
&strSoftwareInstallDate)<BR> End=20
If<BR></FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0029_01C5394E.45CFB640-- Tag: Help - How to display system time (continuously updating) on page complete Tag: 172591
Passing arrays as DialogArguments.. ?? VBS to JS
Hi
Passing objects from Javascript via the DialogArgs works fine.
Creating an Obj in VBScript to pass...??
but Real Question is
Having created a dynamic array in VBscript, populated with the values 1 to 10
ie
dim Arr()
.. // Set the values redim preserrve etc in a loop
..
I call the window.showModalDialog("XXX.htm", arr, "....")
and the receiving XXX.htm dialog window
receives the dialog args as (in JavaScipt )
var oMyObject = window.dialogArguments;
and fails as Type MisMatch
Is this maybe because of slightly different implementations in the languages
of the dialogArguments or ..?
Nonetheless, how do I resolve this ? (I have about 3 days of scripting total
to my name... (years of VB proper though))
TIA
Neal
Neal Rogers
University of Cape Town Tag: Help - How to display system time (continuously updating) on page complete Tag: 172587
Calling VBS function
Hi all,
is there a way to call froma a vbs file a function that resides into another
vbs file ?
Thanks, bye
--
SM Tag: Help - How to display system time (continuously updating) on page complete Tag: 172580
VBScript to Move Ex2003 Mailbox
Hello,
I want to use a VBScript to move a 2003 mailbox from one server to another.
I would prefer to not have to rely on third party software.
This seems like an obvious one but I just can't work it out.
Thsnk you
Shaun Tag: Help - How to display system time (continuously updating) on page complete Tag: 172579
Hiding the source code
How do i hide the source code of my page such that it can't be viewed on a
web browser
regards earnie Tag: Help - How to display system time (continuously updating) on page complete Tag: 172568
"Can't find script engine VBScript for script"
I got the following error "Can't find script engine VBScript for script". I
then download and tried to reinstall Windows Script 5.6 for Windows XP. Then
I got the following error?
Error registering the ocx C:\windows\system32\vbscript.dll
What can I try next? Tag: Help - How to display system time (continuously updating) on page complete Tag: 172567
Rename pc
Hi. Has anyone figured out a way of renaming multiple pc's in an active
directory domain? I have approximately 400 machines in different OU's that
need to conform to the new naming convention we are implementing. I have
found some scripts on how to rename a computer name and some scripts on
renaming the actual account in AD but I have not been able to combine the two
and to create a script that can rename the pc as well as it's account in AD.
Any help would be greatly appreciated.
Thanks,
Morne Tag: Help - How to display system time (continuously updating) on page complete Tag: 172566
reload the vbscript itself within a vbscript
Hi,
What I am trying to achieve is to reload the vbscript within the vbscript,
eg, below code promopt for input, then checks for user input and if the
input is less than 1 character long, the script will reload.
However, the problem is that it is sub procedure, the sInputUserDept is not
global, so the the last line of echo becomes 0. How can I overcome this?
Thanks
Frank
Set objShell = WScript.CreateObject("WScript.Shell")
Call subRepeatInput
sub subRepeatInput
sInputUserDept = CStr(InputBox("Please Enter the Department Name:"))
sInputUserName = CStr(InputBox("Please Enter the PC Owner's Name:"))
If Len(sInputUserDept) = 0 Or Len(sInputUserName) = 0 Then
WScript.Echo "You must enter a PC owner's Department and Name"
objShell.Popup "You must enter a PC owner's Department and Name"
Call subRepeatInput
End If
End Sub
WScript.Echo sInputUserDept + sInputUserName Tag: Help - How to display system time (continuously updating) on page complete Tag: 172564
error 80041004: Provider Failure in accessing CD-Rom
ello,
I am writing a vbscript to access/write to the cdrom drive. The script
fails with the above number/message.
I have also ran <wbemtest.exe> in a command windown, used the root\cimv2
namespace to lookup the W32_CDROMDrive class and after selecting the class
(double clicking on it), if I then 'interrogate' any of the properties using
the buttons: 'Refresh Object' and then 'Instances", I again
get the same error message.
"all" xp methods to view/interrogate the CD *see* the drive and state that
it is functioning correctly (computer management & control
panel-Hardware-Device manager)
I'm stumped, any suggestions? Is WMI broke, or cimv2, or some key in the
registry or is it a case of pilot error???
Thanks,
Thomas Tag: Help - How to display system time (continuously updating) on page complete Tag: 172561
How do we execute or modify this link in asp server side?
HI! I want to execute a link witch is in JavaScript, How do we execute this
in asp server side if possible?
Basically I don't want anyone to see this link in the code view.
this is the link code. below---------------
<script TYPE="text/JavaScript" LANGUAGE="JavaScript"
src='http://www.site1.com/ffff/jjjgtr.php?a=blahlablah&bgcolor=%23FFFFFF&tuck=aaa&sp=0&ft=4&ftt=1&iw=178&ih=198>=yes&hj=rn&src=yes&nt=no'>
</script>
Thanks in advance :) Tag: Help - How to display system time (continuously updating) on page complete Tag: 172556
IP Address Reporting and MAC address
Ok, I finally got the IP addresses for a machine to list out via the
following code...
Next
'IP Address
Wscript.Echo " "
Wscript.Echo " "
Wscript.Echo " IP Addresses "
Wscript.Echo " "
Wscript.Echo " "
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
Win32_NetworkAdapterConfiguration ")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo " IP ADDRESS: " & IPConfig.IPAddress(i)
Next
End If
Next
I would now like to get the MAC Addres and I have tried selecing * from the
WIn32_NetworkAdapterConfig and listing the mac's but I get all the macs for
all the nics, even if they have no IP associated to them... I would like my
output to be IPADDRESS: 0.0.0.0. MAC ADDRESS: xxxxxxxxxxx
Any suggestions on how to change the above code to reflect that? Tag: Help - How to display system time (continuously updating) on page complete Tag: 172553
how to continue running the script
Hi,
I have a while loop which grap computer names from a data file to see if
they are online.
How can i write a code for a senario whereby the script will move on to the
next computer name in the list if error is encountered?
currently it just stops there when error is encountered.
thanks Tag: Help - How to display system time (continuously updating) on page complete Tag: 172551
Remotable WSC not showing up in "dcomcnfg.exe" ?
Hi there,
maybe someone could help me in this corner:
- I created a WSC (a COM component with the logic written in VBasic and ooRexx), which can be
instantiated locally *and* after some research and peeking and poking also remotely (one needs to
use the "remotable"-attribute and then configure the remote access via "dcomcnfg.exe"
- after enhancinge, changing, copying forward and backward, renamed the PROGID and the like; anyway,
locally everything has been working and humming along nicely, but now when trying to test the
remote-instantiation and remote access I need to configure the DCOM part for that WSC; unexplicably,
the WSC-component does not show up anymore? Tried a lot of things (including rebooting the machine a
couple of times just to be sure), but so far I could not come to a solution.
If there is anyone who could give any hints/ideas, I really would appreciate it.
TIA,
---rony
P.S.: Could it be that NTFS-access rights can have an influence on "dcomcnfg.exe" not being able to
find my WSC-component ? (To fight that, I allowed full access to "Everyone" on that particular
directory tree, but who knows?) Tag: Help - How to display system time (continuously updating) on page complete Tag: 172549
copy a folder for every users
I have to create a script that make a copy of a folder (Folder1) in
%username%\Application Data\Folder2 in every client locally when every users
have logon.
This script is called with a group policy linked to "users group".
I found 2 examples in TechNet\ScriptCenter:
----------------------------------------------------------------------------------------
Const OverWriteFiles = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "D:\Folder1" , "D:\%username%\Application Data\Folder2" ,
OverWriteFiles
----------------------------------------------------------------------------------------
or
-----------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery( _
"Select * from Win32_Directory where Name = 'd:\\Folder1'")
For Each objFolder in colFolders
errResults = objFolder.Copy("D:\%username%\Application Data\Folder2")
Next
------------------------------------------------------------------------------------------
This is my question: how can I set %username% in the script for every users?
I tried these 2 script but one does not work and the other create a folder
called "%username%".
Where Do I mistake? How can I solve this problem?
Thanks!
Claudio Tag: Help - How to display system time (continuously updating) on page complete Tag: 172546
VBScript and MS Word Email
I am wanting to create a VBScript using Word to create an email and then
save the email as a draft in Outlook
Does anyone have any examples of such a script.? I have been searching the
web and various books looking for a solution to no avail.
Thanks in advance for the help.
Curtis Tag: Help - How to display system time (continuously updating) on page complete Tag: 172537
Using function name as variable?
Is it considered wise to use a function name within the body of the
function as a variable? For example:
Function ChangeExtension(filename, ext)
Dim fso
If Left(ext, 1) = "." Then ext = Right(ext, Len(ext)-1)
Set fso = CreateObject("Scripting.FilesystemObject")
ChangeExtension = fso.GetBaseName(filename)
If Len(ext) Then ChangeExtension = ChangeExtension & "." & ext
End Function Tag: Help - How to display system time (continuously updating) on page complete Tag: 172533
Replace() funciton - binary vs. text?
I'm not sure I understand how the Replace() function uses the
'compare' argument of either doing binary or text comparison. I can
maybe see using the function for working with some binary data within
a string variable, but I really can't understand why the binary
comparison would be the default.
I almost get the feeling that the binary compare may be intented to do
a case insensitive text comparison, but surely that would be explained
better within the help. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172532
Remote script not running properly..............
I have a script on my local computer which calls another script locally
to run on a remote machine. Then that script is supposed to send some
data back to my local computer. But it doesn't seem to be working
properly.
I have test the script and don't get any error messages but it just
doesn't log the data back to my local computer.
Here's the script which calls the another script to execute on another
computer.
'WSHControl.vbs (runs on the source machine)
Const WshFinished = 2
strComputer = "B000f2030a7fe"
Set wshController = CreateObject("WshController")
Set wshRemote =
wshController.CreateScript("C:\temp\Remote\CtxInstallTest.vbs" ,
strComputer)
WScript.ConnectObject wshRemote, "WSH_"
wshRemote.Execute
'WSHRemote.vbs (this is the file which is copied to the memory of the
'remote machine and should be there executed)
Do While wshRemote.Status <> WshFinished
WScript.Sleep 1000
Loop
Function WSH_End()
MsgBox "wshRemote End Event fired"
End Function
Function WSH_Error()
WScript.Echo "Error Number: 0x" _
& CStr(Hex(wshRemote.Error.Number))
WScript.Echo "Description: " & wshRemote.Error.Description
WScript.Echo "Line Number: " & wshRemote.Error.Line
wshRemote.Terminate()
End Function
Function WSH_Start()
MsgBox "wshRemote Start Event fired"
End Function
The above script calls this script which is stored on my local machine.
On Error Resume Next
Const ForReading=1
Const ForWriting=2
Const ForAppending=20
Const EVENT_SUCCESS = 0
Const EVENT_ERROR = 1
Dim OutFile, OutFilePath, fs, WshNetwork, fsout
strComputer = "."
OutFilePath="\\B000F20307551\GPOInstallLogs\Citrix\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set file = fs.GetFile("C:\Program Files\Citrix\ICA Client\pn.exe")
Filesize = file.size
OutFile = OUtFilePath & "\" & WshNetwork.ComputerName & ".txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(OUtFilePath & "\" & WshNetwork.ComputerName &
".txt") = False Then
If objFSO.FileExists("C:\Program Files\Citrix\ICA Client\pn.exe") and
Filesize = 438544 Then
Set fsout=fs.OpenTextFile(OutFile, ForWriting, True)
fsout.WriteLine "Citrix Program Neighborhood 8.1 installed
successfully." & " Checked on " & Now & vbCrLf
fsout.close
wshShell.LogEvent EVENT_SUCCESS, _
"Citrix Metaframe Program Neighborhood 8.1 installed successfully." ,
"\\B000F20307551"
Else
wshShell.LogEvent EVENT_ERROR, _
"Citrix Metaframe Program Neighborhood 8.1 install failed." ,
"\\B000F20307551"
End If
Else
End If
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.CreateTextFile("C:\temp\Remote\Text.txt", True)
WScript.Sleep 5000
fsoFile.WriteLine "The quick brown fox jumps over the lazy dogs back."
WScript.Sleep 5000
fsoFile.Close
The script seems to execute but doesn't log anything back..... am I
doing something wrong here......I know the script runs if I copy it to
the remote PC but not via using the above wshRemote method. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172531
Auto-logon dilemma
I have a lab of 50 XP pro machines that is sometimes used for exams. When
the exam begins, I run a script that modifies the following registry values
in HKLM\software\Microsoft\Windows NT\CurrentVersion\Winlogon:
AutoAdminLogon (1)
ForceAutoLogon (1)
Default UserName(<username>)
DefaultPassword (<password>)
The script then executes a remote auto-logoff on any logged-on machines, and
those machines promptly log-off and then log back on using the account info
sent to the registry. However, all other machines require the user to press
Ctrl-Alt-Delete before the auto-logon executes. Is there a way through
vbs/wsh to force the auto-logon to happen unattended? In other words, I want
all of the machines to auto-logon, regardless of whether they were logged on
to begin with. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172523
is this possible?
I want to be able to associate a user name (Display Name) to a computer
description when the user logs into the network, is this possible to do.
This is an AD environment and I would like to do this with a login script.
We currenlty do this manually and it would be much easier if this could be
done at login.
Thanks
Gavin... Tag: Help - How to display system time (continuously updating) on page complete Tag: 172521
Downloading a file from a web page
Help me please!
I need to automate the download of a file that is on a web page with NO user
interaction.
An example of what I would like to be able to do is:
cscript DOWNLOADIT.VBS http://www.website.com/dir/FileToDownload.zip
Thanks so much for your help!!!! Tag: Help - How to display system time (continuously updating) on page complete Tag: 172518
need help with group membership
This script doesnt seem to find the group membership and will just map from
the first sub (doesnt matter what group you are in in AD) I am a newbie at
this so I have a couple of questions. Do I need to put the full path in AD
for ie Const TechCorp1 = "cn=Tech.Logon"? But I guess the big question is why
doesnt it get go to the correct mapping? I ran a msgbox and it will list all
the groups I am in. It just wont map the right drives.
here is the code (servers and share is generic here but filled out properly
on my script)
Option Explicit
Dim wshNet
Dim strGroups
Dim GroupMember
Dim a,b
Dim ADSysInfo
Dim CurrentUser
Dim WshShell
Dim objWMIService
Dim colItems
Dim wshNetwork
Dim objitem
Dim computername
Dim strUser
Dim objFSO
Dim objTextFile
Dim CorpServer1
Dim CorpServer2
Dim CountyServer1
'Servers for mappings
'==========================================================================
CorpServer1 = "\\server1"
CorpServer2 = "\\server2"
CountyServer1 = "\\server3"
'Groups from Active Directory
'==========================================================================
Const TechCorp = "cn=Tech.Logon"
Const TechNextel = "cn=Nextel.Tech.Logon"
'==========================================================================
'==========================================================================
'Deletes drives
'==========================================================================
set WshShell = createobject("WScript.Shell")
WshShell.Run "net use * /delete /y",0,true
'Dump txt file.
'==========================================================================
Set WSHNetwork = WScript.CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "s:", "\\server\share"
set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)
For Each objItem in colItems
ComputerName = objitem.CSName
Next
strUser = ""
While strUser = ""
strUser = WSHNetwork.UserName
Wend
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("s:\" & struser & ".txt", True)
objTextFile.WriteLine ComputerName
objTextFile.Close
WSHNetwork.RemoveNetworkDrive "s:"
'==========================================================================
Set WshNet = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" _
& ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
'==========================================================================
'==========================================================================
GroupMember = True
Select Case GroupMember
Case a = InStr(strGroups, TechCorp)
TechCorpSub
Case b = InStr(strGroups, TechNextel)
TechNextelSub
End Select
'==========================================================================
'===========================TechCorp.Logon================================
Sub TechCorpSub
wshNet.MapNetworkDrive "x:", CorpServer1 & "\share"
wshNet.MapNetworkDrive "q:", CorpServer2 & "\share"
wshNet.MapNetworkDrive "t:", CorpServer2 & "\share"
End Sub
'==========================================================================
'===========================TechNextel.Logon===============================
Sub TechNextelSub
wshNet.MapNetworkDrive "x:", CorpServer1 & "\share"
wshNet.MapNetworkDrive "q:", CorpServer2 & "\share"
wshNet.MapNetworkDrive "s:", CorpServer2 & "\share"
wshNet.MapNetworkDrive "i:", CountyServer1 & "\share"
End Sub
'========================================================================== Tag: Help - How to display system time (continuously updating) on page complete Tag: 172517
Setting RDP-TCP Permissions on Win2k
Is there any way to set these permissions via script? We are not yet on AD
and there is no way for me to set it through a local security policy. I
thought about using subinacl to launch from a shell but I cannot find the
functionality in it do set these permissions either. There has to be a way
other than the gui...thx
eric Tag: Help - How to display system time (continuously updating) on page complete Tag: 172515
Active Directory Servers Uptime
Here's something that I had quickly put together some time ago and as an
admin of several remote networks I find it quite handy:
This script will query your AD for server systems and display each machine's
uptime (hours/rounded off days). It'll assume and tell you that the server
is offline if it can't query it. You want to switch your default engine to
Cscript before running it - otherwise it will keep popping up a message box
for each system. Also replace the "domainnamegoeshere" (and perhaps "com")
with your domain name:
On Error Resume Next
'Option Explicit
Dim objRootDSE, strDNSDomain, objConnection, objCommand, strQuery
Dim objRecordSet, strComputerDN, ComputerNameFilter, ComputerNameFilterDC,
FinalFilter, strOS
Dim colOperatingSystems, objWMIService, objOS, dtmBootup, iDate, iBias,
dtmLastBootupTime
Dim dtmSystemUptime
' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use ADO to search Active Directory for all computers.
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strQuery = "<LDAP://" & strDNSDomain _
& ">;(objectCategory=computer);" _
& "distinguishedName,operatingSystem;subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
' Enumerate computer objects with server operating systems.
Do Until objRecordSet.EOF
strOS = objRecordSet.Fields("operatingSystem")
If InStr(UCase(strOS), "SERVER") > 0 Then
strComputerDN = objRecordSet.Fields("distinguishedName")
ComputerNameFilter = Replace(strComputerDN,
",CN=Computers,DC=domainnamegoeshere,DC=com", "")
ComputerNameFilterDC = Replace(ComputerNameFilter, ",OU=Domain
Controllers,DC=domainnamegoeshere,DC=com", "")
FinalFilter = Replace(ComputerNameFilterDC, "CN=", "")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & FinalFilter & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmBootup = objOS.LastBootUpTime
dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
dtmSystemUptime = DateDiff("h", dtmLastBootUpTime, Now)
If Err <> 0 Then
Wscript.Echo (FinalFilter) & " - The system is currently offline"
Err.Clear
else
Wscript.Echo (FinalFilter) & " - The system has been up for " &
dtmSystemUptime & " hrs (" & Round(dtmSystemUptime/24,0) & " days)"
End If
Next
End If
objRecordSet.MoveNext
Loop
' Clean up.
objConnection.Close
Set objRootDSE = Nothing
Set objCommand = Nothing
Set objConnection = Nothing
Set objRecordSet = Nothing
Function WMIDateStringToDate(dtmBootup)
iDate= CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup, _
13, 2))
iBias = Right(dtmBootup, 3)
WMIDateStringToDate=DateAdd("n", iBias, iDate)
End Function Tag: Help - How to display system time (continuously updating) on page complete Tag: 172510
Drop down list box
Is there away to use a drop down list box with VBScript? If so can you point
me to an example.
Thanks! Tag: Help - How to display system time (continuously updating) on page complete Tag: 172509
need help with OpenDSObject
I am writing an HTA that will allow me to add a domain user to the
local Administrators group and can be run even as a lowly user provided
local admin account and password are supplied. I get an error (No
network provider accepted the giver network path) on the "Set
objGroup =" line. Does anyone see what i am doing wrong?
Sub Promote
Set objDSO = GetObject("WinNT:")
Set objGroup = objDSO.OpenDSObject
("WinNT://./Administrators,group", frmRunAs.value, frmPassword.value, 1
AND 2)
Set objUser = GetObject("WinNT://" & frmUserID.value & ",user")
objGroup.Add (objUser.ADsPath)
objGroup.Setinfo
End Sub Tag: Help - How to display system time (continuously updating) on page complete Tag: 172508
Remove Printer Connection (W2K)
Hello,
I want to remove printer connection a workstations connected to my LAN with a script vbs.
But all scripts i have tested are not ok.
I have tested the WshNetwork Object et and the method "RemovePrinterConnection"
("WshNetwork.RemovePrinterConnection PrinterPath, True, True")
but it seems this method doesn't work with IP connection printer :-( and the command returns an error message.
Si i used WMI, but the Delete method is not active on the object Win32_Printer.
So can y ou help me because i haven't another idea to delete my printer connection.
Have you an idea for me plz ?
PS: Sorry for my very very very bad english. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172506
How to calculate Timedifference in Minutes between two dates
Hello everybody
By using vbscript, i would like to calculate the time difference
between two dates in Minutes.
lets say:
Startdate 28.1.2005 10:01:05
Stopdate 5.3.2005 16:48:03
Datediff is doing a good job for the day-calculation.
Anboby knows how to calculate the Timedifference?
Thanks for an hints and tips
Olaf Baumann Tag: Help - How to display system time (continuously updating) on page complete Tag: 172500
Can this be done?
Hello world,
I would like to write a VB script that (when run with admin privileges) can
do the following:
1.) Change the windows password of a specific user;
2.) Send an email.
Can these tasks be done with a VB script?
If so, could you please direct me to the objects/methods required for this?
I looked through the VB documentation, but couldn't find in a hint.
Jens Tag: Help - How to display system time (continuously updating) on page complete Tag: 172497
detect user leaving site or closing browser window
How do I detect if someone is leaving my site or closing their browser
window. I tried the unload event in the body tag, but if a user clicks on a
link to another page on my site, it get's executed. I need only to execute
it if they are leaving my domain or closing their browser window.
please advise.
rafael Tag: Help - How to display system time (continuously updating) on page complete Tag: 172480
Search and Replace
Is there any script that can search through a hard drive looking for a
particular file and replace it?
Thank you in advance. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172464
Help with RIGHT function
I want to set a variable to everything to the right of the second slash in
this string, so I just want to get the page name only:
/whatever/default.asp
I've know I should use the RIGHT function, but I don't know how to use it
without the exact number. The page name will be different each time.
Thanks. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172461
ASP Page tyring to query AS/400 file
I have created an SQL statement that queries a file on our AS/400 using a
DNS-less connection. The AS/400 logs show that I am making a valid
connection, however, I am getting the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0104 - Token ; was not valid.
Valid tokens: <END-OF-STATEMENT>.
IBM says this MS Query is aliasing one of the fields in the query with the
invalid identifier, '$'. The single quotes around the $ character identify
this as a literal value rather than a column identifier. IBM also says this
is a defect in the MS Query 2000 product and to contact Microsoft. The only
reference I found regarding this error on Microsoft dealt with MS Excel. The
error also occurs using a DSN connection. Any insight would be greatly
appreciated. Tag: Help - How to display system time (continuously updating) on page complete Tag: 172460
FTP
I am executing an FTP batch file via vbscipt. It uploads a lot of files. Is
there any way of showing the progress of the upload? Tag: Help - How to display system time (continuously updating) on page complete Tag: 172452
Multiple NICS and recording IP addresses
I want to generate this same result as part of a overall VBSCRIPT but do not
want to reply on GREP; I have tried several routines but they all stop at
the first NIC; can someone give me a hint on how to get this for all NICS
as below without relying on grep?
C:\Documents and Settings\DDoumani\My Documents\_Perot Systems\_Wolters
Kluwer\Documents\WK Scripts>ipconfig | grep -i "IP Add"
IP Address. . . . . . . . . . . . : 192.168.15.102
IP Address. . . . . . . . . . . . : 192.168.15.104
IP Address. . . . . . . . . . . . : 10.138.120.22 Tag: Help - How to display system time (continuously updating) on page complete Tag: 172450
Monitor file creation in subfolders
I pulled a sample script off of TechNet to monitor file creation but it
doesn't monitor anything created in sub folders. How can I modify this
script to do this? I thought you could add a 'LIKE' statement but I don't
know where to do it. Any help would be awesome! Thank you :)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop Tag: Help - How to display system time (continuously updating) on page complete Tag: 172445
Ping using VBS w/o active window
I currently have the following script to ping rather or not a
computer is online.
Set StdOut = WScript.StdOut
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " &
strComputer)
strPingResults = LCase(objScriptExec.StdOut.Readall)
The problem I have, is that it opens a command prompt each time,
changing the active window. This is a bit annoying as I use the
PC while the script is running. I tried changing the script to
this, but I receive an error
Set StdOut = WScript.StdOut
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.run "%comspec% /c ping -n 2 -w
1000" & strComputer,0 ,True
strPingResults = LCase(objScriptExec.StdOut.Readall)
Any assistance is appreciated.
jeff
----------------------------------------------
Posted with NewsLeecher v2.0 RC3
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
---------------------------------------------- Tag: Help - How to display system time (continuously updating) on page complete Tag: 172442
RegExp replace problem
Hi,
I have a problem with a RegExp replace expression that I'm trying to make
for an ASP webpage.
I have the following pattern :
\[mbbs=(?<par1>[^ |\]]*)([ ]+)(?<par2>[^ |\]]*)([ ]+)(?<par3>[^ |\]]*)([
]+)(?<par4>[^\]]*)\]
I want to replace matching expressions with the following :
<html=${par1} ${par2} ${par3}><html-part2 ${par4}><html-part3 ${par2}>
like in this example :
test [mbbs=www.evil-e.net target='_blank' class='test' extra=5] :
more test
But when I try to do this, the browser returns a VBscript runtime error
(0x800A1399) = syntax error in regular expression.
Can someone please tell me what I am doing wrong ?
I don't have a clue what I need to do to make this work.
Thanks al ot in advance... Tag: Help - How to display system time (continuously updating) on page complete Tag: 172439
Exception Occured 0x80020009
I am comparing two fields from two different files. If they are different I
notify either the educational test center or the State Department of
Education that the addresses are not the same.
If rsTstCntr("Address1") = rsTEA("HAddL1") then ' LINE WITH ERROR
rsTstCntr.MoveNext
Else
Response.Write "Error in Files"
End If
Address1 and HAddL1 are always populated. Both records are present, both
field are the same length(33). This error occurs when the fields are not
equal only! The fields are never Null.
Sometimes one field is populated and the other contains blanks (spaces).
Tried for days to get around problem, does anyone have any ideas?
Thanks in advance
Len Tag: Help - How to display system time (continuously updating) on page complete Tag: 172424
write arraydata to textBox
I know this must be simple!!! (but i have a simple mind) please can some
one help... iwant to write contents of array to textBox like so...
For Each one In ArrayuserNames
textarea.value = one & vbCrLf
Next
thanks in advance
*** Sent via Developersdex http://www.developersdex.com *** Tag: Help - How to display system time (continuously updating) on page complete Tag: 172419