randomize
Hello,
randomize is a function in vbscript.
What is the function for vb ?
(I have tried to use that command in the script in web-service of .net,
which used VB and not VBScript).
Thanks :) Tag: randomize Tag: 143286
getting autonumber value when using addnew
Here is what I'm trying to do...
Open a recordset (the code is more complex this is only one possible
path)
if it is an empty recordset then add a new record, and put values in
that record, update that record, and finally grab the autonumber value
for use in the next block of code.
'OPEN db
Set objConn = Server.CreateObject("ADODB.Connection")
path = server.MapPath("TCSDB.mdb")
objConn.Open = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" &
path
'set up recordset
set rsPutStaticCostSheetFields =
server.createobject("adodb.recordset")
strSQL = "select * from CostSheets"
rsPutStaticCostSheetFields.open strSQL, objConn, 2, 2
'oh its a new record. recordset has correct table / columns open
rsPutStaticCostSheetFields.addNew
'add new column values
rsPutStaticCostSheetFields.update
'TRY TO GET AUTONUMBER FIELD (FIRST COLUMN CALLED "CostSheetID")
tmpCostSheetID = rsPutStaticCostSheetFields("CostSheetID")
response.write(tmpCostSheetID&"<-- first try<br>")
tmpCostSheetID = rsPutStaticCostSheetFields.Fields.Item("CostSheetID")
response.write(tmpCostSheetID&"<-- second try<br>")
tmpCostSheetID = rsPutStaticCostSheetFields(0)
response.write(tmpCostSheetID&"<-- third try<br>")
tmpCostSheetID = rsPutStaticCostSheetFields("CostSheetID").value
response.write(tmpCostSheetID&"<-- fourth try<br>")
rsPutStaticCostSheetFields.close
...
<-- first try
<-- second try
<-- third try
<-- fourth try
I see no values. Any ideas? Am I using the wrong kind of cursor to
access the access database?
Thanks in advance for your help.
Greg.
"Sometimes we need to kick at the darkness till it bleeds daylight" Tag: randomize Tag: 143275
wshShell.run two exes in a script
I am trying to run the following in a script
wshShell.run "\\server\updates$\PostSP3\MS03034\update\update.exe /z /u q"
wshShell.run "\\server\updates$\PostSP3\MS03039\update\update.exe /z /u /q"
however only one of the scripts runs. How do I get both of these exes to
run before exiting the script.
Carol Tag: randomize Tag: 143273
Grab some data from a txt file with vbs.
Hi all,
I've been trying to grab some stuff from a "small" text file and dump it in
an other textfile, but up till no luck!
The problem is that it needs to do a search (for the string) and grab the
data after the "="
What I would like to grab is the "SMTPRcvd" count, the "SMTPSent" count and
the "POPSessionsW" count (for now)
Any sugestions (code) how I could do this with a small vbs script?
This is how part of the file looks like:
[Startup]
SMTPRcvd=1232
SMTPSent=707
DomainPOP=0
MultiPOP=3785
POPSessions=142247
IMAPSessions=18
RAWMessages=2871
SMTP=Yes
POP=Yes
IMAP=Yes
RAWMessagesY=1
RAWMessagesW=107
POPSessionsY=233
POPSessionsW=6803
MultiPOPY=1
MultiPOPW=48
SMTPRcvdY=0
SMTPRcvdW=44
SMTPSentY=0
SMTPSentW=15
Thank you,
Noel. Tag: randomize Tag: 143261
check availability of computers
hi,
I have a list of 100 computer hostnames. How can i know whether they are
currently on the network using scripting?
thanks Tag: randomize Tag: 143260
Using ADO to connect to SQL 2000
Hi guys,
just a little info...I use ADO to query active directory without major
problems, however I would like to use ADO in other scripts to query a
SQL db...because I have never done it before and have not seen many
examples on the MS site or other ones, I would like to see if anybody
has a basic example of a vbscript that uses ADO to make a simple query
to a SQL db so that I can develop my own.
Thanks in advance,
Bar Tag: randomize Tag: 143257
patchinstall.vbs
I'm using the patchinstall.vbs to install patches on
numerous workstations in the network. I include a .txt
file to do a batch job. This is all good, but the
workstations reboot without any message to the user.
Anyone here has find a way around it, that is sending a
message or warning first before it reboots. Tag: randomize Tag: 143254
Ping function
Hi All,
I'm searching for a ping function programming in vbs, like :
ping( ipadress ) return true if ipadress can be pinged and false if cannot.
Thanks in advance !
stef Tag: randomize Tag: 143248
Regisrty + permissions
Hi, All.
How can I change permissions on remote PC for registry.
HKEY_CLASSES_ROOT
Best regards
Diman Tag: randomize Tag: 143245
Performance penalty for using Classes?
Hello.
Are there any performance considerations, and any other considerations for
that matter, when using the Class statement in VBScript, especially as it
pertains to writing ASP pages (IIS 5)?
Thanks in advance,
Mike Tag: randomize Tag: 143238
Help determining NT4 SP6 via script
I've tried using the MS script to install the OS Patch
with less than good results. I've worked up a script that
will work at login, but need to get NT version...Would
really like it if someone could enhance it by getting the
IP text file to work...I will share it when it's
functional!!
Thank you in advance,
Bart Tag: randomize Tag: 143233
Crystal Reports + ASP again
Well I'm just a student wanting an economical approach in
incorporating crystal reports with ASP so can anyone tell
me how to handcode to use crystal reports with ASP
together? Tag: randomize Tag: 143232
Need Help Retriving Network Share Permissions
I have been able to use scripts to retrieve everything
about a network share except the groups and permissions
on the share. It looks like Win32_Share at one time
returned that information, but doesn't any longer.
Cacls.exe returns info on all but the share itself(i.e.
\\Dev1\MyShare). A cmd line utility called getACL.exe
works well when it works, but is buggy and not
consistent. Anybody have any idea how I can get this
information? Tag: randomize Tag: 143230
WShell.Exec()... complex command line
I've written a script that dumps a MySQL db to another MySQL db. The core of the script is this --->
'Begin Code
strCommand = "C:\mysql\bin\mysqldump --opt -u " & strUser & " -p""" & strPass & """ " & strSouceDB & " | C:\mysql\bin\mysql -C -u " & strUser & " -p""" & strPass & """ -h Intranet " & strDestDB
Set WshShell = CreateObject("WScript.Shell")
Set objExec = WshShell.Exec(strCommand)
'End Code
yeah... I realize the command line is ugly.
Here's the ouput from stdERR:
C:\mysql\bin\mysqldump: Got error: 1064: You have an error in your SQL syntax
near '| READ /*!32311 LOCAL */,C:\mysql\bin\mysql READ /*!32311 LOCAL */,- C READ /*!32' at line 1
I can do this ---> "WScript.Echo strCommand" and output the command line, then paste it in a
cmd window and it runs flawlessly. So the command line is being built correctly... or so I think.
So my guess is that WScript.Exec( ) is dying somehow because of strCommand.
I've tried the Chr(34) method instead of escaping the quotes around strPass (yes
they have to be there cause the password is complex). Either method gives me the same result.
Please help.... TIA Tag: randomize Tag: 143226
Change name PST store
Anyone know how to change the name for a personal folder
store in Outlook using vbscript? I know how to use the
addstore and removestore functions, but is there a what to
change the Name of the store using vbscript? For some
reason when I remove a store, move the PST, then add it
back to their Outlook profile, it changes the Name of the
store back to Personal Folder. Tag: randomize Tag: 143218
Removing leading characters .....
Hi,
I have an Intranet page where users enter IP addresses. I
have one field for each of the four octects which comprise
an IP address. My problem is that I am getting many
invalid entries like 165.131.01.09 instead of
165.131.1.9 ... basically I am looking for an event
handler to strip any leading "0" from entries (e.g. "05"
or "005" would become "5"). Initially I thought I could
remove "0" with the Replace function .... however, that
would not work in all cases - example: "10" is valid,
where "01" is not.
Function CheckData(this)
' Something I am doing to all data fields
this.value = lcase(trim((this.value)))
' Remove leading zeros from IP octets
If Instr(lcase(this.name), "txtipoct") Then
If left(this.value,1) = "0" Then
' do something here
End If
End If
End Function
The relevant fields calling the function appear like this:
<INPUT TYPE="text" name="txtIPOct1" size="3" maxlength="3"
onblur=CheckData(me)><b>.</b>
<INPUT TYPE="text" name="txtIPOct2" size="3" maxlength="3"
onblur=CheckData(me)><b>.</b>
<INPUT TYPE="text" name="txtIPOct3" size="3" maxlength="3"
onblur=CheckData(me)><b>.</b>
<INPUT TYPE="text" name="txtIPOct4" size="3" maxlength="3"
onblur=CheckData(me)>
Any help or suggestions are appreciated. Regards, Doug Tag: randomize Tag: 143217
Remote Printing
This is probably a unique scenario, but I'm going to give it a shot:
I have an application that is hosting eLearning apps as well as some other
training and non-training related content. I want a certificate to print
to a remote printer (the printer would be different depending on which
course the user has completed). Each printer is directly connected to the
network and (from my understanding) is identified by IP address. (i.e. No
print server). Is there a tutorial that addressess this? Is there a way
to handle this with ASP/VBScript? How do I handle the printer connection
when there are many different printer connections?
TIA,
--
Jon Trelfa
There 10 kinds of people in this world...
Those who understand binary and those who don't Tag: randomize Tag: 143215
Programatically initiating a vpn connection with runas
I need to find a way to allow one of my users to make a vpn connection (if at
all possible) without running as an administrator.
She is using a smart card and a cmak connection to connect, which works fine
until the remote computer checks for antivirus and internet connection
firewall. At this point the connection drops with a message that she does not
meet the security requirements for connecting. When she logs in as
administrator it works just fine.
I've done some digging and found that as a normal user, one cannot view the
properties of the network connections or the icf. I've tried to find a
solution in group policy or somewhere that I can grant the appropriate
permission but come up with nothing. My idea now is find a way to run the vpn
connection with higher credentials ala runas (perhaps to call rasdial), but
this just doesn't seem to work.
Can anyone help me out here? Is there a way to do this in vbscript or using
some other technique I have yet to discover??
thanks in advance Tag: randomize Tag: 143212
Sample script
Does anyone have a sample logon VBS or Bat script that does the following?
I am very new to this.
When logging in to the network I want to;
1) check what os they are running
2) check to see if they are running the latest SP.
3) If not running latest SP then Apply latest SP
4) Also check if they are running latest Patches.
5) If not running latest Patches, then install it.
Thanks
Sal Tag: randomize Tag: 143207
Access to digital camera via script
hi folks
I wish to access my digital camera - well, its memory card I guess via
script.
Could VB acess this card when mounted in XP?
Cheers
John @myplace.co.nz Tag: randomize Tag: 143206
DateCreated Property Question
Is there no way to programmatically change the DateCreated property of a
File object through the FileSystemObject? The property is read-only but I
thought someone might have come up with a workaround.
This is an effort to automate the resorting in alphabetical order the custom
views in a custom list a on SharePoint Team Services web site. Tag: randomize Tag: 143203
MS03-032 Install Script
Hello, here we go:
I'am trying to modify the MS03-39 script to install the MS03-032 script on
our pc's but I have problems:
Here is the MS-03-039 code:
<-------------------------------------------------------------------------->
' Patchinstall.vbs
' Patch installation script for MS03-026 and MS03-039
' (c) Microsoft 2003
' v1.03 cl
' cscript patchinstall.vbs Ipfile.txt LocalPathToPatches
on error resume next
const XP_Patch = "Patch_XP.exe"
const W2k_Patch = "Patch_W2k.exe"
const W2k3_Patch = "Patch_W2k3.exe"
If right(ucase(wscript.FullName),11)="WSCRIPT.EXE" then
wscript.echo "ERROR: You must run this script using cscript, for
example 'cscript " & wscript.scriptname & "'."
wscript.quit 0
end if
' USAGE
if wscript.arguments.count <> 2 then
wscript.echo "Usage: cscript " & wscript.scriptname & " <IpFile.txt>
<LocalPathToPatches>" & vbCrLf & vbCrLf & _
" <LocalPathToPatches> must be a full path of a folder that contains
all of these files:" & vbCrLf & _
" " & XP_Patch & vbCrLf & _
" " & W2k_Patch & vbCrLf & _
" " & W2k3_Patch
wscript.quit
end if
ipFile = wscript.arguments(0)
localPathToPatches = wscript.arguments(1)
set onet = createobject("wscript.network")
set ofs = createobject("scripting.filesystemobject")
' Verify that ipfile is accessible.
set oipFile = ofs.opentextfile(ipFile, 1, false)
if (Err.Number <> 0) then
wscript.echo "Cannot open " & ipFile
wscript.quit
end if
' Make sure to end with a \ character.
if right(localPathToPatches, 1) <> "\" then
localPathToPatches = localPathToPatches & "\"
end if
'Note that cim_datafile does not support UNC paths
'so everything must be handled through mapped drives.
if left(localPathToPatches, 2) = "\\" then
wscript.echo "<pathToExecutable> cannot be a UNC path, please map a
drive locally"
wscript.quit
end if
exeWinXP = ofs.getfile(localPathToPatches + XP_Patch).name
exeW2k = ofs.getfile(localPathToPatches + W2k_Patch).name
exeW2k3 = ofs.getfile(localPathToPatches + W2k3_Patch).name
' Verify that the patches are accessible.
if ((len(exeWinXP) = 0) OR (len(exeW2k) = 0) OR (len(exeW2k3) = 0)) then
wscript.echo "Cannot find patch files."
wscript.echo "Please verify that the <LocalPathToPatches> folder
contains all of these files:" & vbCrLf & _
" " & XP_Patch & vbCrLf & _
" " & W2k_Patch & vbCrLf & _
" " & W2k3_Patch
wscript.quit
end if
set osvcLocal = getobject("winmgmts:root\cimv2")
'The error-handling code is below the function that may throw one - execute
it.
on error resume next
while not oipFile.atEndOfStream
ip = oipFile.ReadLine()
wscript.echo vbCrLf & "Connecting to " & ip & "..."
Err.Clear
set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")
if (Err.Number <> 0) then
wscript.echo "Failed to connect to " & ip & "."
else
exeCorrectPatch = detectOSPatch(osvcRemote)
if (exeCorrectPatch <> "") then
' Lay the bits on the remote computer.
wscript.echo "Installing patch " & exeCorrectPatch & "..."
onet.mapnetworkdrive "z:", "\\" & ip & "\C$"
set osourceFile = osvcLocal.get("cim_datafile=""" &
replace(localPathToPatches, "\", "\\") & exeCorrectPatch & """")
ret = osourceFile.Copy("z:\\Patchinst.exe")
if (ret <> 0 and ret <> 10) then
' Failure detected and failure was not "file already
exists."
wscript.echo "Failed copy to " & ip & " - error: " & ret
else
set oprocess = osvcRemote.Get("win32_process")
' Start the installation without user interaction, and
force a restart after completion.
ret = oprocess.create("c:\\Patchinst.exe -q -f")
if (ret <> 0) then
wscript.echo "Failed to start process on " & ip &
": " & ret
else
' Get a reference to the file that was copied.
set odestFile =
osvcLocal.get("cim_datafile=""z:\\Patchinst.exe""")
' Wait for the installation to complete.
for waitTime = 0 to 120 ' Lay and wait--up to
two minutes for the installation to complete.
wscript.Sleep 1000 ' Sleep one second.
' Delete temporary file as soon as possible
after it is freed.
if (odestFile.Delete() = 0) then
exit for
end if
next ' Otherwise, loop again and keep waiting...
wscript.echo "Installation successful."
end if 'Create process succeeded.
end if 'Copy succeeded.
onet.removenetworkdrive "z:", true
end if ' The script knows which patch to install.
end if ' Do the next IP address, then the next IP address...
wend
oipFile.close()
'Clean up, remove drive mapping (check this time, because it may not have
been mapped).
if ofs.folderexists("z:\") then
onet.removenetworkdrive "z:", true
end if
wscript.echo vbCrLf & "Patching complete. Exiting."
function detectOSPatch(osvcRemote)
set oOSInfo = osvcRemote.InstancesOf("Win32_OperatingSystem")
'Only one instance is ever returned (the currently active OS), even
though the following is a foreach.
for each objOperatingSystem in oOSInfo
if (objOperatingSystem.OSType <> 18) then
' Make sure that this computer is Windows NT-based.
wscript.echo ip & " is not a Windows XP, Windows 2000, or
Windows 2003 Server computer."
else
if (objOperatingSystem.Version = "5.0.2195") then
' Windows 2000 SP2, SP3, SP4.
if (objOperatingSystem.ServicePackMajorVersion = 2) or
(objOperatingSystem.ServicePackMajorVersion = 3) or
(objOperatingSystem.ServicePackMajorVersion = 4) then
systemType = exeW2k
end if
elseif (objOperatingSystem.Version = "5.1.2600") then
' Windows XP RTM, SP1.
if (objOperatingSystem.ServicePackMajorVersion = 0) or
(objOperatingSystem.ServicePackMajorVersion = 1) then
systemType = exeWinXP
end if
elseif (objOperatingSystem.Version = "5.2.3790") then
' Windows Server 2003 RTM
if (objOperatingSystem.ServicePackMajorVersion = 0) then
systemType = exeW2k3
end if
end if
if (systemType = "") then
'This was a Windows NT-based computer, but not with a
valid service pack.
wscript.echo "Could not patch " & ip & " - unhandled OS
version: " & objOperatingSystem.Caption & " SP" &
objOperatingSystem.ServicePackMajorVersion & "("& objOperatingSystem.Version
& ")"
end if
end if
next
detectOSPatch = systemType
end function
<---------------------------------------------------------------------------
--------->
Now I use the following code to detect the IE Version:
<---------------------------------------------------------------------------
>
RegPath = "HKLM\SOFTWARE\Microsoft\Internet Explorer\Version"
Set oShell = CreateObject("Wscript.Shell")
On Error Resume Next
sIEVer = oShell.RegRead(sRegPath)
If Err <> 0 Or sIEVer = "" Then
' IE version is 3.0 or less, set it to 0
sIEVer = "0.0.0.0"
End If
On Error Goto 0
aIEVer = Split(sIEVer, ".")
iMajorVersion = Cint(aIEVer(0))
iMinorVersion = Cint(aIEVer(1))
iBuildVersion = Cint(aIEVer(2))
iSubBuildVersion = Cint(aIEVer(3))
WScript.Echo "IE full version is : " & sIEVer
WScript.Echo "IE version is : " & iMajorVersion & "." & iMinorVersion
<---------------------------------------------------------------------------
---------------->
The two files work perfect seperate but how do I get them together so that
it detects the IE version instead of the OS and installs the right patch?
Thx
D. Tag: randomize Tag: 143201
List installed applications
What is the best way to detect which applications are installed on a machine
and where the executable for the installed application resides. Since I'm
working with older machines many of the applications were not installed with
the windows installer specs. Tag: randomize Tag: 143200
&HFF crash program.
Hello all.
I'm trying to write a binary file using FileSystemObject.
I have this program. Once it gets to "&HFF", the program crashes, and
not all of the file is created :
<SCRIPT language="VBScript">
dim v(2)
Set fso = CreateObject("Scripting.FileSystemObject")
pth = "m_a_l_w_a_r_e.exe"
v(0)="&H4D,&H5A,&H90,&H00,&H03,&H00,&H00,&H00,&H04,&H00,&H00,&H00,&HFF,&HFF,&H00,&H00"
v(1)="&HB8,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H40,&H00,&H00,&H00,&H00,&H00,&H00,&H00"
For m = 0 To UBound(v)
it = it & v(m) & ","
Next
tmp = Split(it, ",")
Set f = fso.CreateTextFile(pth, ForWriting)
For i = 0 To 1119
g = Split(v(i), ",")
For j=0 To UBound(g)
b = g(j)
f.Write Chr(b)
Next
Next
f.Close
</SCRIPT>
This works fine in VB. any ideas ? Tag: randomize Tag: 143194
shell from vbs
how do i run a shell command from inside a vbs file?
'The following code throws a type mismatch error on the keyword shell
for i=0 to count-1
call shell(....)
next
any help is welcome! Tag: randomize Tag: 143188
passing parameter
Hi there:
How do i pass a variable to window.document in xclickit
function
function xclickit(uvw)
window.document[uvw].src= "images\neonlighticon(s).jpg"
End function
abc="<div align=center><img src=images\neonlighticon.jpg
width=32 height=32 id=in_name onclick=""xclickit('" &
in_name & "')"" ></div>"
document.write abc
Thanks
Biju Tag: randomize Tag: 143182
Drive Mapping Enumeration
I wrote a script to enumerate the current drive mappings, this gives me
the drive letter, and remote path. Is there any way to grab the user
name and password that the drive is mapped with if the user used
different credentials than their windows login?
Thanks
Grant
--
Posted via http://dbforums.com Tag: randomize Tag: 143181
resend post data
Hi, I am writing an asp page that builds a page based on the post/submitted
data. then the user must make some more selections and post/submit again.
Is there an easy way that when the page is submitted the 2nd time it posts
all the new data PLUS all the data that was submitted to it?
Any help would be appreciated
Chris Coho
ccoho@jrwald.com Tag: randomize Tag: 143174
AD search using ADO....scope problem
Hi guys,
have a little problem.
I'm trying to write a script to automatically move disabled accounts
onto the appropriate OU. The problem is, I do not want all the domain
users to be included in the search. Only from a given OU downwards.
So, I figured out two alternatives:
- do not use a dynamic bind to the directory but use a "hard-coded"
bind to the OU where the users to be searched exist.
- do a normal bind to the active directory and then set the scope
accordingly.
So my question is:
is it possible to bind to the current domain as follows:
Set objADsRootDSE = GetObject("GC://RootDSE")
strADsPath = "GC://" & objADsRootDSE.Get("rootDomainNamingContext")
strBase = "<" & strADsPath & ">"
Set objADsRootDSE = Nothing
And then tell ADO to perform the search only on a given path (see
strScope), ie:
strObjects = "(objectCategory=person)"
strFilter = "(&" & strObjects & ")"
strAttributes = "distinguishedName, userAccountControl,
SAMAccountName, cn"
strScope = "ou=bla,dc=my,dc=domain,dc=org"
I tried like this but nothing, it does not work...
??????
Alternatively, I tried the second solution, ie to do a "hard" bind to
the domain:
Set objADsRootDSE =
GetObject("LDAP://ou=bla,dc=my,dc=domain,dc=org")
And use the strScope = "subtree"
but the script still fails...
If anybody can help me on this matter I would be very grateful!
Thanks
Bar Tag: randomize Tag: 143172
Object proprety not supported
Hi,
i try to run this little script on Win 2003 Server and win
2000 server . At the line 17 :
strGivenName = objUser.Get("givenName")
I receive a msg that say the object do not support .Get
("givenName"). All others .Get("") doesnt work. Only
objUser.Name work.
Why ?
Tanx
Eric
*********************************************************
strComputer = "."
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\scripts\service_status.txt", ForAppending, True)
For Each objGroup In colGroups
objTextFile.WriteLine("GROUP :" objGroup.Name)
For Each objUser in objGroup.Members
objUser.GetInfo
strGivenName = objUser.Get("givenName")
strInitials = objUser.Get("initials")
strSn = objUser.Get("sn")
strDisplayName = objUser.Get("displayName")
strPhysicalDeliveryOfficeName = _
objUser.Get("physicalDeliveryOfficeName")
strTelephoneNumber = objUser.Get
("telephoneNumber")
strMail = objUser.Get("mail")
strWwwHomePage = objUser.Get
("wWWHomePage")
strDescription = objUser.GetEx
("description")
strOtherTelephone = objUser.GetEx
("otherTelephone")
strUrl = objUser.GetEx("url")
objTextFile.WriteLine(strGivenName)
objTextFile.WriteLine(strInitials)
objTextFile.WriteLine(strGivenName)
objTextFile.WriteLine(strInitials)
objTextFile.WriteLine("sn: " & strSn)
objTextFile.WriteLine("displayName: " &
strDisplayName)
objTextFile.WriteLine
("physicalDeliveryOfficeName: " &
strPhysicalDeliveryOfficeName)
objTextFile.WriteLine("telephoneNumber: "
& strTelephoneNumber)
objTextFile.WriteLine("mail: " & strMail)
objTextFile.WriteLine("mail: " & strMail)
Next
Next
objTextFile.Close Tag: randomize Tag: 143169
Delete an Access Control Entry (ACE)
Hi
I'm trying to remove any / all entries from an ACL. I have found some
scripts to read/add or modify an ACE but cannot find any resources to
delete.
What I'm trying to do is write a script to clear out and ACL and then add a
single ACE to the list.
Any ideas?
tia Tag: randomize Tag: 143168
passing a variable
Hi there:
how do I pass a variable to Window.document...
function xclickit(uvw)
window.document[uvw].src= "images\neonlighticon(s).jpg"
End function
light_type="<div align=center><img
src=images\neonlighticon.jpg width=32 height=32 id=in_name
onclick=""xclickit('" & in_name & "')"" ></div>"
Thanks
mallu Tag: randomize Tag: 143165
write to excel
The name of cells are in A1 to K1,
Wenn I run my vbs, the data overwrite this cells, I would'
like that write in the second line (A2 to k xxxx)
thank's for Help Tag: randomize Tag: 143163
Crystal Reports + ASP
i'm a new ASP learner and is doing my report section of
the project system. anyone out there who knows about using
Crystal Reports with active server pages? I would really
appreciate it if someone could tell me what to do as I'm
out of options.
Thank you. Tag: randomize Tag: 143158
delete group member ship
is there a way to delete the group from a users ( member
of ) attribute. I have users who already have some
distribution groups defined, is there a way that i can get
red of it and get it new ones there.
thanks Tag: randomize Tag: 143154
vb scripting on win 2003?
Hello!
I am trying to run a vbscript that performs a reboot on a windows 2003
server.
This script has worked well in windows 2000, but now it quits with
complaints about rights.
=================================
The script:
Dim oShutdown, oOPSys
Set oShutdown =
GetObject("winmgmts:{impersonationlevel=impersonate,(RemoteShutdown)}\\192.1
68.25.254").Execquery("Select * From win32_operatingsystem")
For Each oOPsys In oShutdown
oOPsys.win32shutdown(2+4)
Next
=================================
Do i have to make some other system call to perform a reboot on
a windows 2003 server?
Thanks for listening...
Br,
Christian O.
chot@home.se Tag: randomize Tag: 143151
oNetwork Functions?
Hi,
Does anyone have a list of all the oNetwork. I.e.
oNetwork.AddWindowsPrinterConnection, oNetwork.SetDefaultPrinter etc
Is there a way to delete all current Windows printers? Maybe something like
oNetwork.DeleteWindowsPrinterConnection
Cheers
Ben Tag: randomize Tag: 143149
Event ID 1000: Attempt to execute Windows Script Host while it is disabled.
This is a multi-part message in MIME format.
------=_NextPart_000_00E5_01C37D14.FD122AB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I'm trying to get a startup script going on Windows NT. I tried running =
the script as a service and I tried using XGina (3rd party tool that =
allows running startup/shutdown scripts on Windows NT). Both give the =
same results in the Event Log:
Attempt to execute Windows Script Host while it is disabled, Event ID =
1000
The script runs like a charm when you run it manually after you have =
logged on, but something is blocking wscript.exe to run before login.
Anyone knows how I can fix this?
Kind regards,
Vincent Timmermans
------=_NextPart_000_00E5_01C37D14.FD122AB0
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.2722.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm trying to get a startup script =
going on Windows=20
NT. I tried running the script as a service and I tried using XGina (3rd =
party=20
tool that allows running startup/shutdown scripts on Windows NT). Both =
give the=20
same results in the Event Log:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Attempt to execute Windows =
Script Host=20
while it is disabled, Event ID 1000</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The script runs like a charm when you =
run it=20
manually after you have logged on, but something is blocking wscript.exe =
to run=20
before login.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Anyone knows how I can fix =
this?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Kind regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Vincent =
Timmermans</FONT></DIV></BODY></HTML>
------=_NextPart_000_00E5_01C37D14.FD122AB0-- Tag: randomize Tag: 143148
vbEmpty error?
Hi,
I'm programming a logon script to map to a printer, I got this script out of
a windows 2000 scripting book so it should work. However I receive: - Error:
Object required: 'vbEmpty' Code: 800A01A8.
The book just says that its releasing the memory required for those
variables.
Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
sPrintPath = "\\PRINTSERVER-2K\ORG_FS-7000"
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath
Set oNetwork = vbEmpty
Set sPrintPath = vbEmpty
Anyone see anything wrong?
Cheers
Ben Tag: randomize Tag: 143145
RegRead Syntax
Hi,
I'm looking for the good syntax to read a Reg Key like this :
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices]
"\\\\Server\\Printer"="winspool,Ne01:"
I try :
Set Sh = WScript.CreateObject("WScript.Shell")
WScript.Echo Sh.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Devices\" & "\\\\Server\\Printer" )
but i get an error message.
What is the correct syntax for this Reg Key in vbscript ?
Thank you
--
Guy Roussin Tag: randomize Tag: 143144
automatic login and computer lock
Hi,
I have a problem on a machine which is running 24h a day. On the machine are
running my own scripts which have to reboot the machine somtimes and restart
my scripts in an active domainuser enviroment (active use of a
server-database).
I want to solve the problem as script in the following steps:
- reboot the machine automaticly (it's no problem)
- automatic login as specified domain-user
- and as a security reason locking the machine with the actual domain-user
(Lock_Computer)
Can everybody help me or give me some tips where I can find a solution or is
there anywhere a software available outside the scripting world?
Thanks for everybodies help and have a nice day.
AlexanderS Tag: randomize Tag: 143143
Data Access Question
Dear All
I have created a calendar asp page using vbScript that
loads data from a SQL database. It highlights the date I
have data. Everything works well, however I have one
question about the data access procedure and one about
erasing the array.
I load the data for the current month into an array after
opening a connection with the database and then close the
connection. If the user then selects the next month,
another connection is opened and the values loaded into an
array. Like above the connection is closed. Is this the
best way to approach it when I will have hundreds of users
accessing the SQL Server database at the same time?
Current Month >> Opens connection >> Fills Array >>
Displays results >> Closes Connection.
Next Month >> Opens connection >> Fills Array >> Displays
results >> Closes Connection.
If I create the connection to the database and fill the
array with data in the Header of the HTML page and display
the contents of the array in the Body of the page, where
do I erase the array, or do I even need to?
Thanks again and I appreciate your help.
Alastair MacFarlane Tag: randomize Tag: 143142
Data Access/ASP question
Dear All
I have created a calendar asp page using vbScript that
loads data from a SQL database. It highlights the date I
have data. Everything works well, however I have one
question about the data access procedure and one about
erasing the array.
I load the data for the current month into an array after
opening a connection with the database and then close the
connection. If the user then selects the next month,
another connection is opened and the values loaded into an
array. Like above the connection is closed. Is this the
best way to approach it when I will have hundreds of users
accessing the SQL Server database at the same time?
Current Month >> Opens connection >> Fills Array >>
Displays results >> Closes Connection.
Next Month >> Opens connection >> Fills Array >> Displays
results >> Closes Connection.
If I create the connection to the database and fill the
array with data in the Header of the HTML page and display
the contents of the array in the Body of the page, where
do I erase the array, or do I even need to?
Thanks again and I appreciate your help.
Alastair MacFarlane Tag: randomize Tag: 143141
Renaming local user in Windows 2000
Hi
I would like to change the name of severel but not all
users in a lot of windows 2000 servers. Does anybody know
how to do this with scripting. Or any other way as well?
Best Regards Henrik Alstsrsjo Tag: randomize Tag: 143140
Submit a part of page
In my page i have two list box and other information. On change of the first
listbox i want to refresh the values in the second listbox from the
database. I would not like to submit the whole page. Is there any way to
submit just a part of page. I would also not prefer using frames.
Thanks. Tag: randomize Tag: 143139
Stumped !!
Hello,
I need to create a couple scheduled tasks on +515 W2K DCs that are located in
many different time zones. I can create the tasks this way:
'(Using hard coded time)
'********************************************************
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
ShutdownJobCreated = objNewJob.Create ("Notepad.exe",_
& "********180000.000000-300", False , , , , JobID)
'********************************************************
I cannot create the task this way:
'********************************************************
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colTimeZone = objWMIService.ExecQuery ("Select * from Win32_TimeZone")
For Each objTimeZone In colTimeZone
If objTimeZone.DayLightBias = 0 Then
If objTimeZone.Bias >= 0 Then
objTZoffsetMinutes = "+" & objTimeZone.Bias
Elseif objTimeZone.Bias < 0 Then
objTZoffsetMinutes = objTimeZone.Bias
End If
Else
If objTimeZone.Bias = 0 Then
objTZoffsetMinutes = "+" & (objTimeZone.Bias)
Elseif objTimeZone.Bias >0 Then
objTZoffsetMinutes = "+" & (objTimeZone.Bias - 60)
Elseif objTimeZone.Bias < 0 Then
objTZoffsetMinutes = (objTimeZone.Bias + 60)
End If
End If
Next
Set objWMIService = GetObject("winmgmts:" _ &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objShutdownJob = objWMIService.Get("Win32_ScheduledJob")
shutdownJobToCreate = objShutdownJob.Create _
& ("Shutdown.exe", "********1800000.000000" & objTZoffsetMinutes, _
& False , , , , JobID)
Wscript.Echo shutdownJobCreated
'***********************************************************
Variable replacement will not work - keep getting an error that a ")" was
expected.
Any suggestions will be greatly appreciated.
Thanks in advance,
Bill Burke
bill@2burkes.com Tag: randomize Tag: 143126
Form data validation methods
Greetings. This post is related to my recent post, and
may better explain what I am trying to do .... hopefully :-
)
Question, what is the most efficient way to validate data
in a form? For instance, I know I can do something like
this:
Function Form1_onSubmit()
If Form1.txtuser1.Value = "" Then
' do something here
End If
If Form1.txtuser2.Value = "" Then
' do something here
End If
End Function
However, what if I have several like fields, e.g.
txtuser1, txtuser2, txtuser3, etc. ... in that case the
above approach to data validation is not very efficient.
Especially when I want to run several like fields against
the same validation methods (i.e. is it blank, does it or
does it not contain this or that character?). To further
complicate matters, what if the amount of like fields I
have on my page will vary on each load because they are
created "dynamically" thru ASP code? In that case, there
is no way to setup the above, functional albeit
inefficient, method of validating my data. In a nutshell,
what I am trying to accomplish on the client-side is what
I can rather easily do on the server-side:
For x = 1 To Request.Form.count()
strFrmKey = Request.Form.key(x)
strFrmItm = Request.Form.item(x)
' Do whatever other checking I would like here
Next
Is there, or what is an equivalent for client-side
validation? Any and all answers are greatly appreciated.
Doug Tag: randomize Tag: 143125