Can I compile / package up client side vbscript so an end user can't view it in a html file?
Hi,
Sorry if this is a stupid question, but I'm a bit new to vbscript...
We've got a client app written so it uses client side vb script in a few
html pages to provide basic functionality (don't ask why, someone else
designed it!). The problem is, you can do the classic 'right click, view
source' and find out exactly how it all works. Not too great eh?
My first question is: Is there a way to remove the vbscript and compile /
obfuscate it into a package which can be included into the project?
Now, we've also got a web site which is also vbscript heavy which has the
same problem. And so, same question again for this...
Thanks in advance,
Martin Pritchard Tag: spam post deleted Tag: 184177
automatically resize a window ? (xp)
I need to automatically size all open and non-mimized windows
(specifically Explorer folder navigation) to the specified height/width
(in twips or whatever unit). Also maybe include a function that reports
the height/width in twips or whatever of the topmost open non-mimized
window. Any idea how to do this from code in either vb.net, vb6,
vbscript... Tag: spam post deleted Tag: 184176
list and loop through files from just using an URL
Hi,
I would like to code in asp/vbscript, a program that will list each
file at a specific URL AND then allow me to loop through those files.
The folder on this remote browser would be set to "List Folder
Contents"
the problem is that the code using
_______________________
dim oxml
set oxml = createobject("msxml2.xmlhttp")
oxml.open "GET", "http://www.whatever.com/directorytobrowse/", false
oxml.send
response.write(oxml.responsetext)
_____________________________
just show returns the page with the listing of the files, which I can't
loop through the files
I would like some code that would allow something like this....
for each file in oxml
response.write(oxml.filename)
end
Thanks if anyone know how do this. (I would rather not parse through
oxml.reponsetext to try to extract the file names) Tag: spam post deleted Tag: 184173
Rename Windows 2000 computer
Hi,
I'm trying to rename a Windows 2000 computer in a NT 4.0 domain by vbscipt
code. But the code as far as I found is not compatible with Windows 2000.
Appreciate any help, thanks.
ErsinC Tag: spam post deleted Tag: 184172
remove exchange attributes
I have a vbscript that will create exchange mailboxes for my AD users.
I am interested in a script to remove those attributes. I am looking for a
way to automate the Exchange Tasks\Remove Exchange attributes task.
Hopefully someone can help me.
Paul Tag: spam post deleted Tag: 184169
Start Access Application from vbScript
I am totally new to vbScript.
I have an Access application that I want to kick-off using VBscript, but I
have not been able to figure out how to do it. I would like the script to
open the application in hidden mode, then execute the Autoexec macro that is
in the app.
Can anyone suggest a format for this operation? How about a good text for
someone that has been programming in VBA (mostly Access, but some Excel) for
about 7 years. Tag: spam post deleted Tag: 184168
Another Question:(
Hi Again Group,
I have the following code which deletes all file over 7 days old.
sDateTime = Year(dDate) & Right(100 + Month(dDate),2) _
& Right(100 + Day(dDate),2) & "_" & Right(100 + Hour(dDate),2) _
& Right(100 + Minute(dDate),2) & Right(100 + Second(dDate),2)
sFilename = sDateTime & ".zip"
'Delete OLD Data - This Keeps 7 Days worth of Backups
Set Folder = FSO.GetFolder("C:\zips\DataBackup\HFSdata")
For Each File in Folder.Files
If DateDiff("d", CDate(File.DateLastModified), Now()) > 7 Then
FSO.DeleteFile File
Next
What I would like to be able to do is if the file is Less than 24 Hours old
copy the Data to a Zip Disk on Drive Z:
I guess I would Add in something like:
If DateDiff("d", CDate(File.DateLastModified), Now()) > 7 Then FSO.CopyFile
File?? but I can`t find any info on the net tho:( Anybody kindly give me
some code or point me in the right direction?
Many Thanks
Regards
NSC Tag: spam post deleted Tag: 184167
Automatically Do IP and Docs
Hi Group,
Sorry if this is a simple on but im a newbie to all this scripting. I have
the following as part of my VB Script:
Const DriveLetter = "H:"
Const SharePath = \\10.109.220.10\c$\Documents and
Settings\Holderness.Road\My Documents
As Im deploying this to many machines, I would like to be able to
automatically get the Machines IP Address and Logged on Users My Documents
Path.
Could somebody possible point me in the right direction.
Many Thanks
NSC Tag: spam post deleted Tag: 184166
Pick List is displaying but cannot pick from
New to VBScript.
I've written a script which brings back a list of recent entires, the
idea beign our users pick the one they require rather than having to
remember their references. I've got the list to display but it doesn't
allow them to click on any. Code is below, where ABCDEF is our
database. Appreciate your help here, thanks.
-----------------------------------------------------------
sub main()
Set cnABCDEF = CreateObject("ADODB.Connection")
cnABCDEF.ConnectionString =
"ODBC;DATABASE=ABCDEF;DSN=ABCDEF;UID=xxx;PWD=xxx;APP=ABCDEF"
cnABCDEF.Open
Set cmdQuery = CreateObject ("ADODB.Command")
With cmdQuery
Set .ActiveConnection = cnABCDEF
.CommandText = "Select mattercode, matter from vw_refno where fe =
'JEH' and status = 'O' order by lasttime"
.CommandType = adCmdText
End With
Set matters = CreateObject("ADODB.Recordset")
Set matters.Source = cmdQuery
matters.Cursortype = adOpenForwardOnly
matters.CursorLocation = adUseClient
matters.LockType = adLockReadOnly
matters.Open
If matters.State = adStateOpen Then
Do While Not matters.EOF
strMsg = strMsg & matters.Fields("mattercode").Value
strMsg = strMsg & ":" & vbTab
strMsg = strMsg & matters.Fields("matter").Value
strMsg = strMsg & vbNewLine
matters.MoveNext
Loop
Matters.Close
MsgBox strMsg
Else
MsgBox "Recordset not opened"
End If
Set matters = Nothing
Set cmdQuery = Nothing
cnABCDEF.Close
Set cnABCDEF = Nothing
end sub Tag: spam post deleted Tag: 184165
Help, script to find user not logged in for a number of time (usiing LastloginTimeStamp)
Hi,
Well, my script (below) is supposed to find all user's on the domain
which have "password cannot expire" falgged, aswell as a list of all
users (by name) who have not logged on for a month.
If we only use the line:
(userAccountControl:1.2.840.113556.1.4.803:=65536); in the LDAP search
query, the script works fine, and returns a list of all user by name.
But when (lastLogonTimeStamp<= 127751249340000000) is added in the
search, the script returns nothing,
any advice would be great appreciated.
Regards
Khurram
Orion4_@hotmail.com
'
------------------------------------------------------------------------------------------------
' UserAudit_2.vbs
' Creates a report based on AD user properties for security auditing
purposes
'
------------------------------------------------------------------------------------------------
On Error Resume Next
'set parameters for ADOB Connection
Set objADConnection = CreateObject("ADODB.Connection")
Set objADCommand = CreateObject("ADODB.Command")
objADConnection.Provider = "ADsDSOObject"
objADConnection.Open "Active Directory Provider"
Set objADCommand.ActiveConnection = objADConnection
objADCommand.Properties("Page Size") = 1000
'connect to AD using LDAP, and search for users with
'the "ADS_UF_DONT_EXPIRE_PASSWD" flag (use value 65536)
objADCommand.CommandText = _
"<LDAP://DC=rfs,DC=nsw,DC=gov,DC=au>;" & _
"(&(ObjectCategory=Person)(objectCategory=User)(lastLogonTimeStamp<=
127751249340000000)(userAccountControl:1.2.840.113556.1.4.803:=65536));"
& _
"Name;Subtree"
'Define Record set
Set rsAD = objADCommand.Execute
'start at beggining of Record Set
rsAD.MoveFirst
'Print out the names of all users in RS
Do Until rsAD.EOF
Wscript.Echo rsAD.Fields("Name").Value
rsAD.MoveNext
Loop Tag: spam post deleted Tag: 184156
bug?
I found my .bat file setting environment variable from result of vbscript
but the value disappear right away/
bat file statements
@@rem some code that set up values for strdate with values like
strdate=Nov 29 18:38
echo %strdate%| For /F "usebackq tokens=1-2" %%i in (`cscript //nologo
"D:\util -misc\ConvertMMM_DD_HH_MM.vbs" `) do set DtRapidLstDnlod=%%i %%j
@@echo @debug newdt=%dtnew%
@@echo @debug DtRapidLstDnlod=%DtRapidLstDnlod%
@@echo stop for debug
@@rem end of bat file
Now I see output
c:\>set DtRapidLstDnlod=2005-11-29 %J
@debug newdt=Nov 29 18:38
@debug DtRapidLstDnlod=
stop for debug
here is the code for vbs file
dim newDt , sDt, str
str = wscript.stdIn.ReadLine
newDt = Cdate(str)
sDt = "" & newDT
if len(sDt) = 17 then
sDt = "20" & sDt
End If
wscript.echo sDt
what did I miss?
from the output the vbscript does seem to function correctly, but somehow,
the value of variable being set gets lost. and become some funny empty
value.
If I enter in command prompt
set dt
I get
DtRapidLstDnlod= Tag: spam post deleted Tag: 184155
Can I detect the Serial Number of a PC in a start up script
I would like to gather the Make, Model, and Serial Number of a PC during the
boot process. I am having difficulty doing so under restrictive user
accounts in my domain and am hoping a startup script running under the
system account would work.
Any ideas would be appreciated. Tag: spam post deleted Tag: 184152
List user's mapped drives on a remote PC
I'm trying to come up with a scripted methodology of listing the mapped
drives of the current user on remote PCs. I've found an article on Technet's
Hey Scripting Guys archive
(http://www.microsoft.com/technet/scriptcenter/resources/qanda/oct05/hey1027.mspx
) that describes what I want to do perfectly. I have built my script around
this code, but have found that, although the article states "As usual, you
can modify this script to run against a remote computer simply by assigning
the name of that machine to the variable strComputer", you cannot enumerate
the shares on a remote PC (XP in this case) - the response always comes back
blank. The same methodology works great when run locally on the PC.
How would I go about listing the mapped drives used by the current user of a
remote PC?
TIA
--
Scott McWilliams
EDS Canada Tag: spam post deleted Tag: 184144
Option Explicit Issue
Hi,
I'm using Option Explicit to force all variables to be declared in my
script, however this doesn't seem to be the case. It seems from a
certain point forward in my script I can use variables without
declaring them first. Any idea what has happened here? I know this
obviously sounds a little odd, I'm sure there's a sensible solution to
whatever has happened.
Thanks,
Steve Tag: spam post deleted Tag: 184141
WMI Chipset Model and revision
Does anyone know how to get the Chipset model name (i845, i955) and revision
using WMI.
I've searched several classes but none returning this information. Whats
interesting is the registry has this info??? but it is stored differently
with each machine.
Thanks
C- Tag: spam post deleted Tag: 184136
How do I run this in VBscript?
I am trying to run this in a vbscript and i am not quite sure how to do
this, if I run it in a .bat file it runs no problem... any help would be
appreciated...
\\testdc\mailsend\MailSend -from test@test.com -smtp mail.test.net -to
test@test.com -msg "Your Files have been uploaded to the following FTP Site
ftp://192.168.0.1 please use the following username - test and password -
password to access the site. Thank You "
Thanks
Gavin... Tag: spam post deleted Tag: 184134
Applying Hex Value to Registry
Hello,
I'm new to vbscript and i'm having a problem when i try to apply a registry
key. Here is my line of code:
WshShell.RegWrite
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState",
0c0002001b01e77760000000 "REG_DWORD"
I'm having trouble with the hex syntax. Would anyone know how to write this
correctly?
Thanks
--
-Maro Tag: spam post deleted Tag: 184131
Find SP2 - [WILDPACKET]
Any body has a script which will find all the Windows XP Clients running SP2
our find SP1 in our domain?
******************************
Have this LDAP Query.
(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP
Professional)(!operatingSystemServicePack=Service Pack 1))))))
This query works but also picks up all the XP PCs which are also running
SP2. I just want the query to pick SP1 PCs. Any ideas any thing wrong with
this query?
Please advise.
Thank you Tag: spam post deleted Tag: 184128
replace string
i have a log file in this format...
a,b,c,d,e,f,g
a,b,c,d,e,f,g
a,b,c,d,e,f,g
a,b,c,d,e,f,g
it finish with double newline ( /n)
i need to replace the last caracther of the file, like typing a backspace.
any idea?? Tag: spam post deleted Tag: 184119
VPS reads XML
Hi,
I am looking a Vbscript to read mssecure.xml or any xml files. JavaScript is
OK too.
Thanks,
Wensi Tag: spam post deleted Tag: 184116
Run Logon Script on Workstations Only
I am creating a script that I want to run at logon in a Windows NT
domain, but want it to execute on Windows 2000 or XP Professional
Workstations only, not on Servers. We have several admins that use the
same username to log on to both their workstations, and servers,
creating issues if the same script executes when they log on to their
servers.
While I am able to use the System environment variable to determine
that the OS is Windows_NT, and use a subsequent registry read of
HKLM\Software\Windows NT\CurrentControlSet\CurrentControlSet to
determine the OS version as 5.0 or 5.1. This doesn't tell me whether
the machine is XP/2000 professional, or server 2000/2003.
This sounds real easy, but I have been researching this, and, as of
yet, have been unable to locate an efficient way to tell whether the
local machine is a workstation or server. Do you have any suggestions
that will work in a large environment (10000 + workstations and
servers)? Tag: spam post deleted Tag: 184115
Executing Applications on a Server Through an ASP Page
pardon me if this is a wrong group to post this question...!
I am trying to invoke a batch file on the server using a link/button on the
ASP web page.
I tried
Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.Run("C:\test1.bat")
-***-
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = "cmd.exe"
Executor.Parameters = "/c c:\test1.bat"
Executor.ShowWindow = False
strResult = Executor.ExecuteWinApp
Neither of them work......
any ideas.....
thanks in advance,
_Uday Tag: spam post deleted Tag: 184108
How do I remove 8 Characters from the Right of a variable?
How do I remove characters from the right of a populated variable, removing
@bla.com from a UPN for example? Assume variableA = first.last@bla.com
I've tried using things like - variableB = Right(variableA, 8), I know it
returns the last 8 as the variable I'm using - variableB =
StripRightNCharacters(variableA, 8), this one returned nothing so I may be
using it wrong.
I know the characters I want to remove, they are always on the right and
always the same number, and always the same characters, like @bla.com
Everything seems to be geared towards counting from the left and trimming,
but the number of characters on the left change in my example...
Is there a simple function I can call that I'm not seeing?
Thank you,
--
Sean M. Loftus
Enterprise Architect
Loftus Consulting, Inc.
www.LoftusConsulting.com
sean(removeme)@loftus.org Tag: spam post deleted Tag: 184103
Error loging in VBscript
I have a script that is doing a few thing like running out to the web
and unzipping files is there any way to have the script create and send
all error to a log file. Tag: spam post deleted Tag: 184102
Logging a script timeout
I have a login script that i have set to timeout if it runs for more than 30
secs using wscript.timeout. But now i would like to be able to write this
timeout event to the event log. Is this possible. Tag: spam post deleted Tag: 184100
OU printing
Below is a printer script I am running through a GPO on an OU, If the
computer and printer are in a top level OU then it works ok. Once the
computer goes into an OU that is one OU level deeper it doesnt work. Have
configured each OU the same as far as printers computers an policies. I just
move the printer and computer to the next OU and it doesnt work. It's like
the script isn't reading deep enough.
DOMAIN.COM
OU 1 (works)
OU 2 (No working)
OU 3 (works)
OU 4 (No working)
Can anyone help?
__________________________________________________________________________________________________________________________
Option Explicit
Dim objWshNetwork '<Windows Script Host Network Object>
Dim strComputerName '<CN= + Computer name string>
Dim strDomain '<Domain Name string>
Dim strLDAPDomain '<String to query the LDAP server>
Dim arrayDomain '<Temp Array>
Dim intCount '<Temp Counter>
Dim objOUPrintQues '<Object to hold the list of Printers>
Dim objPrinter '<Printer Object>
Dim objOUComputers '<List of computer objects>
Dim objComputer '<Computer object>
Dim strComputerOU '<String of the OU the computer is in>
Dim objOUList '<List of OU objects>
Dim objOU '<OU Object>
Dim boolFound '<Flag that the computer is found>
'********************* Very important, change only this
*********************************************************
strDomain = "home.com" '<Enter the Domain name, KEEP THE QUOTES>
' Notes:
' Use the DNS name! ie domain.com
'
'*****************************************************************************************************************
Set objWshNetwork = WScript.CreateObject("WScript.Network") '<Make a new
network object>
strComputerName = "CN=" & objWshNetwork.ComputerName '<Get the current
computer name and add "CN=" to the begining
'strComputerName = "CN=JaysPC" '<Debugger>
strLDAPDomain = "LDAP://"&strDomain '<Set the LDAP string to get all
the AD OU Objects
On Error Resume Next '<Turn on Error Handling>
Set objOUList = GetObject(strLDAPDomain) '<Get all the AD OU Objects>
If err <> 0 Then '<Catch the error, exit if error>
WScript.Echo "Error: " & err.number & " The Domain: "&strLDAPDomain& " was
not found. Check the logon script or network connection. REF:AD Objects"
Set objWshNetwork = Nothing
Set objOUList = Nothing
WScript.Quit
End If
On Error Goto 0
'<---------------------------------------- FIND WHAT OU THE COMPUTER IS
N --------------------------------------------------------------------->
For Each objOU In objOUList '<Step through each OU in domain>
strLDAPDomain = "LDAP://"&strDomain&"/" &objOU.Name '<Add the OU to the
end of the LDAP string>
arrayDomain = split(strDomain,".") '<Break up the domain name into
parts>
For intCount = 0 to ubound(arrayDomain)
strLDAPDomain = strLDAPDomain & ", DC=" & arrayDomain(intCount) '<Add
the search base>
next
On Error Resume Next '<Turn on error handling>
Set objOUComputers = GetObject(strLDAPDomain) '<Get all the objects in
the current OU>
If err <> 0 Then '<Catch the error, exit if error>
WScript.Echo "Error: " & err.number & " The Domain: "&strLDAPDomain& " was
not found. Check the logon script or network connection. REF:OU Objects"
Set objWshNetwork = Nothing
Set objOUList = Nothing
Set objOU = Nothing
Set objOUComputers = Nothing
Set arrayDomain = Nothing
WScript.Quit
End If
On Error Goto 0
objOUComputers.Filter = Array("Computer") '<Filter the objects, only
care about computers>
For Each objComputer In objouComputers '<Step through each computer
in the OU>
If objComputer.Name = strComputerName then '<If the current computer
is in this OU...>
boolFound = TRUE '<Set found to TRUE>
Exit For '<Stop searching this OU>
end if
Next
If (boolFound) Then
Exit For '<Found the computer in this OU, stop searching the OUs>
End If
Next
'<------------------------------------------------------------------------------------------------------------------------------------------------------->
On Error Resume Next '<Turn on error handling>
Set objOUPrintQues = GetObject(strLDAPDomain) '<Get all the objects in
the current OU>
If err <> 0 Then '<Catch the error, exit if error>
WScript.Echo "Error: " & err.number & " The Domain: "&strLDAPDomain& " was
not found. Check the logon script or network connection. REF:Printer
Objects"
Set objWshNetwork = Nothing
Set objOUList = Nothing
Set objOU = Nothing
Set objOUComputers = Nothing
Set arrayDomain = Nothing
Set objComputer = Nothing
Set objOUPrintQues = Nothing
WScript.Quit
End If
On Error Goto 0
objOUPrintQues.Filter = Array("PrintQueue") '<Filter the objects, only
care about printers>
For Each objPrinter In objouPrintQues '<Step through each printer in
OU>
If Trim(LCase(objComputer.Description)) =
Trim(LCase(objPrinter.Description)) Then '<If the printer and computer
description are same>
'<----Descriptions are the same, install the printer AS
DEFAULT ----------------------------------------------->
'WScript.Echo "Adding the printer: " & objPrinter.strPrinterPath & " - as
Default" '<debugger>
SetUpPrinter objPrinter.PrinterPath, TRUE '<Install the Default
Printer>
'<------------------------------------------------------------------------------------------------------------->
Else
'<----Descriptions are different, install the printer
anyway -------------------------------------------------->
'WScript.Echo "Adding the printer: " & objPrinter.strPrinterPath & " - NOT
as Default" '<debugger>
SetUpPrinter objPrinter.PrinterPath, FALSE '<Install the Printer>
'<------------------------------------------------------------------------------------------------------------->
End If
Next
'<-- Clean up memory -->
Set objWshNetwork = Nothing
Set arrayDomain = Nothing
Set objOUPrintQues = Nothing
Set objPrinter = Nothing
Set objOUComputers = Nothing
Set objComputer = Nothing
Set objOUList = Nothing
Set objOU = Nothing
WScript.Quit
'<End of Main Program>
'<---------------------------------------------------------------------------------------------------------------------------------------------------->
Function SetUpPrinter(strPath,boolSetToDefault)
On Error Resume Next '<Turn on error handling>
objWshNetwork.AddWindowsPrinterConnection strPath '<Add the printer>
If err <> 0 Then '<Catch the error, return if error>
WScript.Echo "Error: " & err.number & " The Printer: "& strPath & " was
not found. Logoff and Login again or check the logon script or network
connection. If this persists, restart your server."
Exit Function
End If
On Error Goto 0 '<Turn off error handling>
If (boolSetToDefault) Then
objWshNetwork.SetDefaultPrinter strPath '<Set the printer to default>
End If
End Function
_________________________________________________________________________________________________________________________ Tag: spam post deleted Tag: 184093
Newbie Needing Help
Hi there Group,
Hope somebody wouldn`t mind helping me out here?
I`ve Created the following VB Script:
Set objShell = CreateObject("WScript.Shell")
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
dDate = Now
sDateTime = Year(dDate) & Right(100 + Month(dDate),2) _
& Right(100 + Day(dDate),2) & "_" & Right(100 + Hour(dDate),2) _
& Right(100 + Minute(dDate),2) & Right(100 + Second(dDate),2)
sFilename = sDateTime & ".zip"
'WScript.Echo sFilename
'Set a Backup job to PKZip
objShell.Run "C:\pkware\pkzip25\pkzip25 -add -path=relative
C:\zips\DataBackups\HFSdata" & sFilename _
& " c:\hfsdata\*.*"
objShell.Run "C:\pkware\pkzip25\pkzip25 -add -path=relative
C:\zips\DataBackups\BomTrans" & sFilename _
& " c:\bomtrans\*.*"
objShell.Run "C:\pkware\pkzip25\pkzip25 -add -path=relative
C:\zips\DataBackups\MyDocuments" & sFilename _
& " c:\Documents and Settings\%USERNAME%\My Documents\*.*"
'Delete OLD Data - This Keeps 7 Days worth of Backups
Set Folder = FSO.GetFolder("C:\zips\DataBackups\HFSdata")
For Each File in Folder.Files
If DateDiff("d", CDate(File.DateLastModified), Now()) > 7 Then
FSO.DeleteFile File
Next
Set Folder = Nothing
Set FSO = Nothing
Set Folder = FSO.GetFolder("C:\zips\DataBackups\BomTrans")
For Each File in Folder.Files
If DateDiff("d", CDate(File.DateLastModified), Now()) > 7 Then
FSO.DeleteFile File
Next
Set Folder = Nothing
Set FSO = Nothing
Set Folder = FSO.GetFolder("C:\zips\DataBackups\MyDocuments")
For Each File in Folder.Files
If DateDiff("d", CDate(File.DateLastModified), Now()) > 7 Then
FSO.DeleteFile File
Next
Set Folder = Nothing
Set FSO = Nothing
What I would like to do is at the end of the running, send e-mail to the
User to Tel Them the Filenames of the 3 Files Created, and Weather of Not
the backup was sucessfull of wether it failed. How would I go about this?
Like i said Im a newbie so would be greatfull if somebody could explain
simply for me?
Many Thanks
NSC Tag: spam post deleted Tag: 184092
Table querying in ASP
This is a simple question, so sorry for my newbieness. How do I query
data about a html table? Specifically I want to know how many columns
there are currently. I thought something like this would have worked:
<% NumCols = Request("Columns") %>
But it doesn't. Any help greatly appreciated. Thanks.... Tag: spam post deleted Tag: 184090
QUERY: auto clean VB editor
Is there any way to auto clean indent the VB code? If not, anyone know an
additional 3rd party program to do so? Such cleaning eg. removing trailing
whitespace, formating/correct indentation, etc. Tag: spam post deleted Tag: 184089
deleting users in AD
Hi
I've written a script to delete some users from Windows 2000 Active
Directory, I would also like to remove their home folders and Exchange
mailboxes.
I'm using the code below:
--------------------------------------------------------------------------------------------------------------------
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.OpenTextFile("C:\temp\DelUser.txt")
Do While not f1.atEndOfStream
strUser = f1.readline
Set objItem = GetObject("LDAP://CN=" & strUser &_
",ou=Management,dc=NA,dc=fabrikam,dc=com")
strprofilePath = objItem.Get("profilePath")
' WScript.Echo "profilePath: " & strprofilePath
strhomeDirectory = objItem.Get("homeDirectory")
' WScript.Echo "homeDirectory: " & strhomeDirectory
fso.deletefolder strhomeDirectory, True
Set objOU =
GetObject("LDAP://ou=Management,dc=NA,dc=fabrikam,DC=com")
objOU.Delete "User", "CN=" & StrUser
Loop
----------------------------------------------------------------------------------------------------------------------------
The code to delete the users works fine (their names are all in a text
file which the script reads). I can also read the users home folder
but I cannot work out a way to delete the folder once it is read. I'm
also unsure as to how to go out about removing the users Exchange
mailboxes as I am deleting them.
Any help greatly appreciated.
Tony Tag: spam post deleted Tag: 184088
Read csv text file and write new file without header or eof char
All,
Can anyone tell me hoe or provide a sample vb script that will read a
csv text file and write it to a new file without the header and the
end of file character ?
TIA!
cmoorhead@mindspring.com Tag: spam post deleted Tag: 184080
pc performance troubleshooting
Anyone have a nice script that will report some common config issues /
problems that might affect pc performance? I am thinking vbs version of
PCPitstop or some similar tool. Tag: spam post deleted Tag: 184076
File extension and ftp problem
I'm sorry for my bad english but I'm Italian...
How I can write a vbs script for search file with "xml" extension and copy
them on a remote machine...
Thank's Tag: spam post deleted Tag: 184075
Cross site / cross domain question
Hi folks,
I need your help!
I need to set values of a form from a page inside a frameset at other domain.
OR
Take the value of a hidden field value in a form from a page inside a
frameset at other domain.
Thanks in advance. Tag: spam post deleted Tag: 184073
Replace text within file based on file name
Hello:
I am working on a script that takes a .txt log file and puts it in a
database. I have everything working on this script with the exception of one
small item: Date Conversion (which I am manually doing at this time).
I need to replace the format of the date (YYYY-MM-DD) in the text file to be
the same format as the filename.
Filename:
11-27-2005-PingLogs.txt
Sample text:
2005-11-27 00:00:47,192.168.2.1,Ping: No Response
2005-11-27 00:00:47,192.168.2.1,Ping: No Response
2005-11-27 00:00:47,192.168.2.1,Ping: No Response
2005-11-27 00:00:47,192.168.2.1,Ping: No Response
2005-11-27 00:00:47,192.168.2.1,Ping: No Response
Converted date:
11-27-2005,00:00:47,192.168.2.1,Ping: No Response
11-27-2005,00:00:47,192.168.2.1,Ping: No Response
11-27-2005,00:00:47,192.168.2.1,Ping: No Response
11-27-2005,00:00:47,192.168.2.1,Ping: No Response
11-27-2005,00:00:47,192.168.2.1,Ping: No Response
How can I find each occurrence of the YYYY-MM-DD format and replace it with
the same format in the filename?
P.S. I cannot get the date to export any other way to the log file.
Thanks
CADstillo Tag: spam post deleted Tag: 184071
newbie: errorhandling on wshshell.regread
dear vbs gurus
the following code reports an error -> invalid root in registrykey, if the
registry key is not existent. why does my error handling not return ->
Function False instead of the error box displayed. thanx alot
tim
snip.........................
If CheckRegKey(strMapNameKey)= True then
MsgBox " Function True "
Else
MsgBox " Function False "
End If
Function CheckRegKey(RegStr)
On Error Resume Next
WshShell.RegRead RegStr
If Err Then
CheckRegKey = False
Else
CheckRegKey = True
End If
On Error Goto 0
End Function Tag: spam post deleted Tag: 184060
Please critique this HTA (Change Database Remotely)
Hello. As a novice in both VBScript and HTML, I usually find code
snippets, tweak 'em to my specifications, then bolt 'em all together to
accomplish what I need. Like in this case. The following script works
fine, but I'm sure it can be streamlined, corrected, and the redundancy
removed.
This HTA will be used to "change the database" of a remote server,
which involves 3 major tasks:
A. Make specific changes to the Registry (using .REG files)
B. Copy a specific Configuration.xml file
C. Restart IIS
The high level functions of the HTA are as follows:
1. Enter or select a server (opens that server's version.ini file once
selected)
2. Select a "release" (determines the source PATH for the
Configuration.xml and .REG files)
3. Select a "database" (determines the source Configuration.xml and
.REG files to be copied)
4. If the target Configuration.xml and .REG files exist and are Read
Only, remove the Read Only attribute
5. Enable the "Change Database" button only when the server, release
and database have been selected.
6. After the "Change Database" button is clicked and the script is
executed:
- reset all variables
- reset text and list boxes
- disable the "Change Database" button
Some obvious things that I imagine can be addressed:
- The conditional IF statement used to enable the "Change Database"
button...I've had to put it in multiple subroutines. Is there a better
way?
- I'm using the sysinternals.com utility PSEXEC to remotely change the
Registry. Is there a better way?
- I'm using the sysinternals.com utility PSEXEC to remotely restart
IIS. Is there a better way?
- I'm using repeated entries of the HTML " " to insert a large
number of spaces in between text and listboxes. Is there a better way?
Any suggestions would be greatly appreciated. Thanks!
- Dave
Watch for word wrap:
===== BEGIN Change_Database_Remotely.hta ====================
<html>
<head>
<title>Change Database Remotely</title>
<HTA:APPLICATION
ID="HTAUI"
APPLICATIONNAME="HTA User Interface"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximized"
>
</head>
<style>
BODY
{
background-color: buttonface;
font-family: Helvetica;
font-size: 12pt;
margin-top: 2px;
margin-left: 8px;
margin-right: 3px;
margin-bottom: 3px;
}
</style>
<SCRIPT language="VBScript">
Dim strServer
Dim strVersionFile
Dim strRelease
Dim strReleasePath
Dim strDatabase
Dim strNewREGFile
Dim strREGPath
Dim s
Dim r
Dim fso
Dim f
Dim sFILE
Dim objShell
Dim objWshScriptExec
Dim objStdOut
Dim objFSO
Dim strREGFileSourcePATH
Dim strREGFile
Dim strTargetPATH
Dim strEXEFile
Dim strConfigPath
Dim strNewConfigFile
Dim strConfigFileSourcePATH
Dim strTargetConfigFile
Dim strREGImportCMD
Dim strIISResetCMD
Sub Window_Onload
self.Focus()
self.ResizeTo 600,500
self.MoveTo 200,50
' Clear all variables in order for the
' "Enable Change Database button" IF statement to work
strServer = ""
strRelease = ""
strDatabase = ""
End sub
Sub ServerButton
strServer = txtServerInput.Value
strCMD = "notepad"
Set objShell = CreateObject("WScript.Shell")
If strServer = "" Then
strServer = cboServerSelection.Value
strVersionFile = "\\" & strServer & "\D$\Program Files\Adss\Patch
Level\Version.ini"
Set objWshScriptExec = objShell.Exec (strCMD & " " & strVersionFile)
Else
strVersionFile = "\\" & strServer & "\D$\Program Files\Adss\Patch
Level\Version.ini"
Set objWshScriptExec = objShell.Exec (strCMD & " " & strVersionFile)
End If
' Enable Change Database button when all criteria is selected
If strServer <> "" and strRelease <> "" and strDatabase <> "" Then
ChangeDatabase_button.Disabled = False
spServer.InnerHTML = strServer
End Sub
Sub ReleaseSelectList
strRelease = ReleaseSelection.Value
If strRelease = "July" Then
strReleasePath = "July 2005 Release\"
Else
strReleasePath = ""
End If
' Enable Change Database button when all criteria is selected
If strServer <> "" and strRelease <> "" and strDatabase <> "" Then
ChangeDatabase_button.Disabled = False
spRelease.InnerHTML = strRelease
End Sub
Sub DBSelectList
strDatabase = DBSelection.Value
strNewREGFile = strDatabase & ".REG"
' Enable Change Database button when all criteria is selected
If strServer <> "" and strRelease <> "" and strDatabase <> "" Then
ChangeDatabase_button.Disabled = False
spDatabase.InnerHTML = strDatabase
End Sub
Sub ChangeDatabase
' Copy REG.EXE and Database REG file to target server temp folder
strREGPath = "\\ServerName\D$\ASISS Team\Tools\Reg Keys\"
strREGFileSourcePATH = strREGPath & strReleasePath & strNewREGFile
strTargetPATH = "\\" & strServer & "\C$\TEMP\"
strEXEFile = "\\ServerName\D$\ASISS Team\Tools\Batch\Reg.exe"
' Modify the Read Only attribute if necessary
If CreateObject("Scripting.FileSystemObject").FileExists(strTargetPATH
& strNewREGFile) Then
' Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(strTargetPATH & strNewREGFile)
' If the first bit of the attributes byte is set to 1,
' the file is Read Only.
' If this is the case, clear the first bit.
If f.attributes and 1 Then
f.attributes = f.attributes - 1
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile strREGFileSourcePATH, strTargetPATH, True
objFSO.CopyFile strEXEFile, strTargetPATH, True
Set fso = Nothing
Set f = Nothing
Else
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile strREGFileSourcePATH, strTargetPATH, True
objFSO.CopyFile strEXEFile, strTargetPATH, True
End If
' Copy Database CONFIG file to target server Webview folder
strConfigPath = "\\ServerName\D$\ASISS Team\Tools\XML Config Files\"
' Check to see if "TEST" is in the file name
s = "TEST"
r = InStr(strDatabase, s)
If r = 1 Then
strConfigDatabase = right(strDatabase,2)
strNewConfigFile = "Configuration-" & strConfigDatabase & ".xml"
Else
strConfigDatabase = strDatabase
strNewConfigFile = "Configuration-" & strConfigDatabase & ".xml"
End If
strConfigFileSourcePATH = strConfigPath & strReleasePath &
strNewConfigFile
strTargetConfigFile = "\\" & strServer &
"\D$\Inetpub\wwwroot\WebView\Configuration.xml"
' Modify the Read Only attribute if necessary
' Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(strTargetConfigFile)
' If the first bit of the attributes byte is set to 1,
' the file is Read Only.
' If this is the case, clear the first bit.
If f.attributes and 1 Then
f.attributes = f.attributes - 1
End If
Set fso = Nothing
Set f = Nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile strConfigFileSourcePATH, strTargetConfigFile, True
' Change Registry
strREGImportCMD = "Psexec" & " \\" & strServer & " " & "cmd /c
C:\TEMP\REG IMPORT"
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(strREGImportCMD & " " &
strNewREGFile)
' Restart IIS
strIISResetCMD = "Psexec" & " \\" & strServer & " " & "cmd /c
C:\WINNT\system32\IISRESET /RESTART"
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(strIISResetCMD)
Set objStdOut = objWshScriptExec.StdOut
' Display the output of strIISResetCMD
strOutput = objStdOut.ReadAll
MsgBox strOutput, vbInformation, "Change Database Remotely -
COMPLETED."
' Disable Change Database Button
ChangeDatabase_button.Disabled=True
' Clear variables
strServer = ""
strRelease = ""
strDatabase = ""
' Reset all text and list boxes
txtServerInput.value = ""
cboServerSelection.value = ""
DBSelection.value = ""
ReleaseSelection.value = ""
End Sub
' Cleanup
Set strServer = Nothing
Set strVersionFile = Nothing
Set strRelease = Nothing
Set strReleasePath = Nothing
Set strDatabase = Nothing
Set strNewREGFile = Nothing
Set strREGPath = Nothing
Set s = Nothing
Set r = Nothing
Set fso = Nothing
Set f = Nothing
Set sFILE = Nothing
Set objShell = Nothing
Set objWshScriptExec = Nothing
Set objStdOut = Nothing
Set objFSO = Nothing
Set strREGFileSourcePATH = Nothing
Set strREGFile = Nothing
Set strTargetPATH = Nothing
Set strEXEFile = Nothing
Set strConfigPath = Nothing
Set strNewConfigFile = Nothing
Set strConfigFileSourcePATH = Nothing
Set strTargetConfigFile = Nothing
Set strREGImportCMD = Nothing
Set strIISResetCMD = Nothing
</SCRIPT>
<BODY>
<H2 align="center">Change Database Remotely</H2>
<p align="left"><font face="serif" size="4"><b>Enter or select a server
(it's version.ini file
will open):</b></font><br/>
<align="left">
<input type="text" id="txtServerInput"/><br/>
<align="right">
<select id="cboServerSelection">
<option value="0"></option>
<option value="Server1">Server1</option>
<option value="Server2">Server2</option>
<option value="Server3">Server3</option>
<option value="Server4">Server4</option>
<option value="Server5">Server5</option>
<option value="Server6">Server6</option>
</select><br/>
<button onclick="ServerButton">Submit</button>
<p align="left"><font face="serif" size="4"><b>Select a
release: Select
a database:</b></font><br/>
<align="left">
<select id="ReleaseSelection" onChange="ReleaseSelectList">
<option value="0"></option>
<option value="July">July</option>
<option value="December">December</option>
</select> <select
id="DBSelection" onChange="DBSelectList">
<option value="0"></option>
<option value="TESTAJ">TESTAJ</option>
<option value="TESTAP">TESTAP</option>
<option value="TESTAT">TESTAT</option>
<option value="TESTZB">TESTZB</option>
<option value="TESTZE">TESTZE</option>
<option value="TESTZF">TESTZF</option>
<option value="TESTZG">TESTZG</option>
<option value="TESTZH">TESTZH</option>
<option value="TESTZJ">TESTZJ</option>
<option value="TESTZL">TESTZL</option>
<option value="TESTZS">TESTZS</option>
<option value="TESTZT">TESTZT</option>
<option value="TESTZU">TESTZU</option>
<option value="FPT">FPT</option>
<option value="PIONEER">PIONEER</option>
<option value="Production_Training">Production_Training</option>
<option value="PRODUCTION">PRODUCTION</option>
</select><br/>
<p>
<hr>
<span id =spServer></span>
<p>
<span id =spRelease></span>
<p>
<span id =spDatabase></span>
<hr>
<p align="left">
<input id=ChangeDatabaseButton class="button" type="button"
value="Change Database"
name="ChangeDatabase_button" onClick="ChangeDatabase" Disabled=True>
</BODY>
</html>
===== END Change_Database_Remotely.hta ==================== Tag: spam post deleted Tag: 184057
Img Src=asp page
Hi,
My site (site A) is a referral site that sends leads to advertisers (site B)
on our site.
When the user clicks on one of the advertisers, we drop a cookie on their
machine. The cookie has an expiration date of 30 days.
When the user buys a product and the receipt page is loaded, there is an
image tag pointing to an asp page on Site A.
For instance (<img src="
http://www.siteA.com/roitracker/roitracker.asp?ID=123&price=456&orderNo=789"
width=1 height=1>)
As you can see, we pass 3 parameters. We upload those parameters to our
database.
This code works in Firefox. It only works in IE if we allow permissions for
3rd party cookies. Any ideas how to solve this issue and get around the
security for IE? is there another way that we can fix this issue?
Please advise.
Thanks Tag: spam post deleted Tag: 184056
Sounding audible alert in script.
I would like to sound a periodic "ding" in a long running script, something that
would sound without halting script progress. All I have been able to do is
insert a message box, but that stops the script until the box is dismissed by
the user. Is there any way to sound an alert without stopping for a user
response?
--
Crash Tag: spam post deleted Tag: 184055
Excel 2003 filesystem dialog box...
Is there a way to open an explorer type dialog box to help a user
select a folder to save a document in?
For instance, the user clicks on a submit button in a worksheet and a
explorer like dialog opens where the user and browse to the desired
folder and the click okay to pass that folder path back to the VBA
script.
Thanks
Kevin Tag: spam post deleted Tag: 184053
Script request
I am looking for a script that will scan a set of computers (based on an
ActiveDirectory OU), and generate a list of all services, and their running
account... (Not really required if the account is LOCAL SYSTEM). Also, a
script that will scan all workstations/servers and generate a list of local
accounts. I believe I have seen a RESKIT TOOL, that will generate a list of
local account but must be on a machine by machine basis. Tag: spam post deleted Tag: 184051
Create ODBC source - how to ?
Hi,
Do I have a way to call SQLConfigDataSource and SQLInstallerError from
VBScript ?
Or may be there is other way to achieve equivalent functionality ?
Thank you in advance for your replies. Tag: spam post deleted Tag: 184050
Network Neighbourhood enumeration - how to ?
Hi,
Of course it is possible to spawn 'net view' and look through its
printout,
But I would like to do this in proper Shell/COM way.
I.e. starting from 'Entire Network', getting network types,
then workgroups inside them, then computers inside workgroups.
Please give me a direction on where to dig
Thank you in advance. Tag: spam post deleted Tag: 184047
Sending an email message
Hi,
I'm not very familiar with using vbScript and MS Office products. Can
someone point me in the right direction regarding an error I am receiving
when trying to send an email? The error I am getting is "The 'SendUsing'
configuration value is invalid."
My code looks like this:
Set oMyMail = CreateObject("CDO.Message")
oMyMail.To = "user@test.com"
oMyMail.Subject = "Test Mail from script"
oMyMail.Textbody = "Please ignore"
oMyMail.AddAttachment "C:\output.txt"
oMyMail.MIMEFormatted = False
oMyMail.Send
WScript.Echo "Message Sent From : " & oMyMail.From
WScript.Echo " to : " & oMyMail.To
I don't know if this is significant, but I'm using an Exchange 5.5 server, I
have Outlook 2002 running as my client, and I am logged in as a
non-Administrator.
Thanks in Advance,
JeffH Tag: spam post deleted Tag: 184041
Script to reboot PCs
Hi all,
I was wondering if you can show me the code necessary reboot a Windows 2K or
Windows XP equipmented PC? I frequently remote into a number of PCs and
sometimes the need a reboot. Instead of asking someone directly and asking
them to reboot the machines, isn't there a way to write a VBS script to do
that?
Can you also share with me the JScript equivalent for the WSH environment?
Many thanks.
Ben
-- Tag: spam post deleted Tag: 184033
Just-In-Time Debugger Shows Runtime Error in Startup Dialogue Box
I'm just completing a working VBScript to use Telnet to send an e-mail
when an error is detected by a scheduled task (for my sample I'm using
not enough space on the C drive). I'm aware that there are also other
solutions such as BLAT but I don't want to install any code.
Everything seems to work well and I get the e-mail in my account but I
have this nagging concern.
The dialogue box labelled "Just-In-Time Debugger" has at the top the
message "An exception 'Runtime Error' has occurred in Script.". It
then lists Possible Debuggers of "New instance of Microsoft Script
Debugger" and "New Instance of Microsoft Script Editor". If I step
through there aren't any apparent problems. Do I really have a
problem? Thoughts??? Tag: spam post deleted Tag: 184032