retrieve russian text from database
I am having a huge problem retrieving russian text from a mysql database.
The text is viewed correctly within the database but when I use asp/vbscript
to retrieve the text, every russian character is returned as a "?"
I have tried Session.CodePage = 65001 and Response.CharSet = "UTF-8" but
still get the same problem. Could anyone please shed any light, this has
become a huge problem for me.
Many thanks
Dave Tag: Create Network Bridge Tag: 206092
Executing VBScript Winnt machines
Hi,
Can we execute VBScripts Winnt machines?
I am getting an exception while executing the wbem.exe on Winnt
machines
C:\WINDOWS\system32\wbem\wbem.exe
Please let me know.
Thanks,
Regards,
Pramod Ingle Tag: Create Network Bridge Tag: 206088
Wait for FSO.CopyFolder to complete before continuing
I have as part of a VBS log on script a need to copy a folder to a
users profile.
I want to ensure that the folder and its contents have been copied
before continuing with the script.
Any ideas how I can achieve this? Tag: Create Network Bridge Tag: 206087
cd rom name
My problem is someone has left a disk in a cd rom drive
I would like to know if there is a way to gather the information in
the my computer
Most c: drives are name local disk but if there is a cd rom in the cd
rom drive the drive name will change to reflect this. I would like to
find be able to scan a computer and gather all the drives available on
that computer. We have no mapped drives so that won't be a problem
thanks,
Rogue Tag: Create Network Bridge Tag: 206078
Renaming files in folder
Can someone show me how I'd rename files in a folder.
I have a folder with 92 jpg images in it all named something like
S0001234.jpg. I want to rename them all 1.jpg, 2.jpg, 3.jpg and so on. I
also want to name everything in another folder 1t.jpg, 2t.jpg, 3t.jpg
and so on.
I know this would be a loop somehow but, well, how?
My beginners VBScript/WSH book is at home otherwise I'd try to get
started on it then post what i've got here.
TIA,
Jim Tag: Create Network Bridge Tag: 206076
Help with ASP Insert into SQL
I'm trying to pull data from a form and insert it into sql. This is
what I have:
<%
Answer = Request("Value")
pull_rs("INSERT INTO tSurveyResult (Result) VALUES (" & Answer &")")
%>
And the error message I get is
2147217900 - Line 1: Incorrect syntax near ')'.
What am I doing wrong? Tag: Create Network Bridge Tag: 206067
Script to Zip Files
I hope I am posting this to the correct group. If not, please let me know.
I inherited a VBS program that executes WinZip to compress files. Based on
what has been done in the past, this was run manually each time by simply
clicking on the file. I have run it successfully many times since I took
over the task.
I am attempting to automate this by adding this to Scheduled Tasks. Now,
the program fails. As near as I can tell, the failure occurs at the point
that the WinZip command is to be executed. The line I believe is failing is:
WshShell.Run ZipCommand, 1, True
The ZipCommand contains the actual WinZip command to be executed such as:
c:\winzip100\wzzip "d:\tstar\ADM CY2006.zip" @"d:\tstar\ZIPLIST_ADM.txt"
I have two questions:
1) Can someone offer some insight as to why this would fail when executed
from Scheduled Tasks, but work fine manually? Or is there a better approach
to get this done?
2) I have been searching for information on the last two parameters of the
Run command ("1" and "True") but cannot find anything. Can someone tell me
what they are used for and the valid entries for each?
I have limited experience with scripts so please be patient.
Thanks. Tag: Create Network Bridge Tag: 206066
Window.Open fails with certain Japanese Characters on IE7
Hi,
When the two Japanese characters ー and シ� are used in the window name
parameter of the window.open function, the expected new browser window does
not open. See sample code below. This needs to be tested on localised
Japanese operating system.
The problem only happens on IE7 browsers (on all operating systems). IE6
works ok.
Is this a known issue? Any suggestions for a possible solution?
Rgds.
Noel
<Script language="VBScript">
Sub Func_BtnPress()
Dim strFeature, strUrl, strWinName
strFeature =
"location=no,menubar=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,height=600,width=800"
strUrl = "NewWindow.asp"
'strWinName contains Japanese characters ー or シ�
strWinName = "ーシ�"
window.open strUrl, strWinName, strFeature
End Sub
</Script>
<html>
<head>
<title>Nortel Networks</title>
</head>
<BODY>
<table align=center><tr><td>
<input type="button" id="btnOpen" name= "btnOpen" value="Open new
window" Title= "Open new window" onclick = "Func_BtnPress()">
</td></tr></table>
</BODY>
</HTML> Tag: Create Network Bridge Tag: 206064
Hourglass
Is it possible to show instead of an arrow as mouse an hourglass as in VBA,
or something else?
Rolf Grüne Tag: Create Network Bridge Tag: 206057
Create New Worksheet
Every morning an Excel spreadsheet is generated with the same name
overwriting itself with new data, call it NEW.xls
Can someone guide me in writing a script that copies or writes this data
into a new worksheet in EXISTING.xls? How do you go about labeling
worksheets?
Thanking you in advance
--
Jeff C
Live Well .. Be Happy In All You Do Tag: Create Network Bridge Tag: 206056
script for searching a string in a log file
Hi all, I need to write a vbscript to search a string value in a text log
file. If the string value is present, it will send an email. I know the
script for sending the email.
Please someone help me for searching a log file. Tag: Create Network Bridge Tag: 206054
Unzipping compressed files
I receive information via compressed files that I place in appropriate
folders to be unzipped and processed later. My VB program does much of the
processing for me once the files are manually unzipped one by one, but I
could use a bit of VB code that would unzip and then delete these original
compressed files. Can't seem to find anything on this subject. S.F. Tag: Create Network Bridge Tag: 206053
Environment issue's Please help
Hi all,
i have the following problem
sorry my english is not that great.
I have 1 vbscript in with 2 things happen
1: install an MSI if not installed
2: if MSI is installed execute the advertised shortcut.
the script works great but we have one issue
If the MSI (we take ORACLE for example) set or expands a windows
systems variable like the "Path=%Path%;C:\Oralce" the seconde action
of the script doen't expands environment variables like the path en
ORACLE gives a error becourse the path is nog found.
This is becourse the vbscript doen't expands the new installed windows
variable.
my question is how can I expand reload the windows environment
variables in a running VBSCRIPT?
i have many workarrounds like putting the environments in a
logonscript and solutions like that but I want 1 vbscript.
can anybody help me i am not that great with vbscipt.
greatings
Roger Tag: Create Network Bridge Tag: 206052
VB Script to read Excel file
Hi,
Small question: I have a simple Excel file and I'm trying to write a
VB Script that will get a string and will search for it in the Excel
file at a certain column. When string was found I would like to know
the right line.
Note: string appears only once in a specific column.
Any suggestions...?
Shai. Tag: Create Network Bridge Tag: 206047
calling helper applications?
Hi,
I'm a bit vexed by one of the limitations of VBscript. I have to
write byte arrays to a data source, and there doesn't appear to be any
way at all to do it. I can read them just fine, but have had no luck
modifying and storing them back. I can do this just fine with VB6 but
my shell app is in script.
If I compile a little exe in VB6 to do this for me, is it possible to
call it from a Script? I'm guessing not but I'm crossing my fingers
here.
Thanks
Eric Tag: Create Network Bridge Tag: 206043
Script to change registry setting in 100 servers
I need to change a regisrty setting in 100 servers and the setting is
different for each servers.
I have an excel file that has the info and I need to have a script to
connect to 100 servers and read the excel sheet with the registry info and
update each servers registry based on that excel sheet.
Can anybody send me a sample script.
If not the whole script just the part to connect to all these 100 servers
listed in this excel sheet.
Thanks Tag: Create Network Bridge Tag: 206041
New forest namespace for migration
I'm looking to consolidate 5 forests into a single forest AD design. My
question is, though, can a new forest exist in an existing forest's
namespace? In other words, can new.company.com be a new forest if
company.com is one of the existing forests?
--
Tim Tag: Create Network Bridge Tag: 206033
Adding Username and password to Printer Connect Script.
I am trying to make a script that i can easily send to a client to connect to
printers on the network.
So far its gone well and im able to run the script on my computer and
connect to the printer.
But the issue im having is when i have a client come into the network that
are not on the domain, or when i have computers that will never be on the
domain and happen to get reset and lose there privilages to a printer.
How do i add a username and pass into the script so it will authenticate and
allow the computer to connect to the printer?
' PrintersLong.vbs - Windows Logon Script.
' VBScript - Connect a network printer with AddWindowsPrinterConnection
' VBScript - Set Printer to default with SetDefaultPrinter
' Author Eric Heyn http://www.wctv6.com
' Version 1.1 - May 15th 2007
'
------------------------------------------------------------------------------
Dim objNetwork, strUNCPrinter, strTrueName, strPrinterName, strError,
strOption, strTitle
strTitle = "WCTV Printer Connect V1.1"
StrOption = Inputbox ("Select Printer Desired", StrTitle)
If StrOption = 1 Then strTruename = "weather-office"
If StrOption = 1 Then strPrinterName = "HP Weather"
If (StrOption < 1) Or (StrOption > 1) Then strError = "1"
If StrError = 1 Then Msgbox "Invalid Choice please restart", vbOKOnly,
strTitle
If StrError = 1 Then WScript.Quit
strUNCPrinter = "\\" & strTrueName & "\" & strPrintername
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
Msgbox "Printer :" & strTrueName & ": added as default", vbOKOnly, strTitle
WScript.Quit
' End of Eric's Windows printer script.
' Next Version Add "Make Default? Yes/No"
' Next Version Pull Printer True ShareName and Display It
' Added Msgbox
' Added Title.
' Added Inputbox with HP Printer as 1
' Added Inputbox error message with quit command Tag: Create Network Bridge Tag: 206031
Enumerate local groups and use in a drop-down box in a HTA
Hi,
I have a HTA we use for new users. It create a home folder and add the
user to the right local group etc.
RMTSHARE.EXE and XCACLS.EXE is needed in the same folder as the HTA.
It works fine for us but instead of having a static list of groups i
want to enumerate the groups based on which server is choosed and add
the groups to the list in the drop-down box where i choose groups.
Any ideas on how to do this?
I made a Sub that enumerates the groups but i don't know how i could
get the result in the drop-down box.
________________________________________________________________________________________
<html>
<head>
<title>.:: Our ::. Add new user tool</title>
<HTA:APPLICATION
ID="Add_new_user_tool"
APPLICATIONNAME="Our Add new user tool"
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">
on error resume next
Dim strServer
Dim strGroup
Dim strDomain
Dim strUser
Dim strHomeFolder
Dim s
Dim r
Dim fso
Dim f
Dim objShell
Dim objStdOut
Dim objFSO
Dim objUser
Dim objGroup
Sub Window_Onload
self.Focus()
self.ResizeTo 600,500
self.MoveTo 200,50
' Clear all variables in order for the
' "Enable Create button" IF statement to work
strServer = ""
strGroup = ""
strDepartment = ""
strUser = ""
End sub
Sub ServerSelectList
strServer = cboServerSelection.Value
' Enable Create button when all criteria is selected
If strServer <> "" and strUser <> "" and strGroup <> "" and
strDepartment <> "" Then Create_button.Disabled = False
spServer.InnerHTML = "Server where home folder will be created:" & " "
& strServer
End Sub
Sub UserButton
strUser = txtUserInput.Value
' Enable Create button when all criteria is selected
If strServer <> "" and strUser <> "" and strGroup <> "" and
strDepartment <> "" Then Create_button.Disabled = False
spUser.InnerHTML = "UserName will be added to group, also to be used
for home folder name:" & " " & strUser
End Sub
Sub GroupSelectList
strGroup = GroupSelection.Value
' Enable Create button when all criteria is selected
If strServer <> "" and strUser <> "" and strGroup <> "" and
strDepartment <> "" Then Create_button.Disabled = False
spGroup.InnerHTML = "Group where " & strUser & " will be added: " &
strServer & "\" & strGroup
End Sub
'Sub enumGroups
'strComputer = cboServerSelection.Value
'Set colGroups = GetObject("WinNT://" & strComputer & "")
'colGroups.Filter = Array("group")
'For Each objGroup In colGroups
' strGroup = objGroup.Name
'Next
'End Sub
Sub DepartmentSelectList
strDepartment = DepartmentSelection.Value
' Enable Create button when all criteria is selected
If strServer <> "" and strUser <> "" and strGroup <> "" and
strDepartment <> "" Then Create_button.Disabled = False
spDepartment.InnerHTML = "Home folder will be created in: " & "\\"&
strServer & "\d$\path\" & strDepartment & "\" & strUser
End Sub
Sub Create
' Add User to group
strDomain = "Domain"
Set objGroup = GetObject("WinNT://" & strServer & "/" & strGroup &
",group")
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser &
",user")
objGroup.Add(objUser.ADsPath)
' Create Home Folder
strHomeFolder = "\\" & strServer & "\d$\path\" & strDepartment & "\" &
strUser
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder(strHomeFolder)
' Share the folder
If FSO.FolderExists(strHomeFolder) Then
' Share the folder and assign rights.
strShare = " \\" & strServer & "\" & strUser & "$="
strSharePath = "d:\path\" & strDepartment & "\" & strUser
strGrant = " /GRANT " & strUser & ":change /GRANT administrators:f /
GRANT SYSTEM:f"
Set oShell = CreateObject("WScript.Shell")
intRunShareError = oShell.Run("%COMSPEC% /c Echo Y| RMTSHARE.EXE" &
strShare & strSharePath & strGrant, 0, True)
If intRunShareError <> 0 Then
MsgBox "Error creating share or asigning permissions for
user " _
& strUser & " to home folder " & strHomeFolder
Else
MsgBox "Home folder " & strHomeFolder & " is created and shared
as \\" & strServer & "\" & strUser & "$. User " & strUser & " is added
to " & strServer & "/" & strGroup & " !"
End If
End If
' Set permissions on the Home folder
If FSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
Set oShell = CreateObject("WScript.Shell")
intRunPermError = oShell.Run("%COMSPEC% /c Echo Y| xcacls " &
strHomeFolder & " /T /C /G Administrators:f SYSTEM:f " & strUser &
":C", 2, True)
If intRunPermError <> 0 Then
MsgBox "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If
' hide the folder from other users
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFolder(strHomeFolder)
objFile.Attributes = objFile.Attributes + 2
' Disable Create Button
Create_button.Disabled=True
' Clear variables
strServer = ""
strGroup = ""
strUser = ""
strDepartment = ""
strDomain = ""
' Reset all text and list boxes
cboServerSelection.value = ""
txtUserInput.Value = ""
DepartmentSelection.value = ""
GroupSelection.value = ""
End Sub
' Cleanup
Set strServer = Nothing
Set strUser = Nothing
Set strGroup = Nothing
Set strDepartment = Nothing
Set strHomeFolder = 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
</SCRIPT>
<body STYLE="
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#CCCCCC', EndColorStr='#FFFFFF')">
<H2 align="center">Add user to groups and create Home folder</H2>
<table border="0" cellpadding="0" cellspacing="0" style="width: 565px;
height: 104px">
<tr>
<td valign="top" style="height: 30px">
Select a server:</td>
<td valign="top" style="height: 30px">
Enter Username:</td>
</tr>
<tr>
<td valign="top" style="width: 281px; height: 30px;">
<select id="cboServerSelection" onChange="ServerSelectList"
name="ServerSelection" tabindex="1">
<option value="0"></option>
<option value="servername1">SERVERNAME1</option>
<option value="servername2">SERVERNAME2</option>
</select></td>
<td valign="top" style="width: 284px; height: 30px;">
<input type="text" id="txtUserInput" name="UserInput"
value="xxx0yyy" size="7" tabindex="2"/>
<button onclick="UserButton" name="SubmitUser" tabindex="3">Submit</
button></td>
</tr>
<tr>
<td valign="top" style="height: 30px">
Select a group:</td>
<td valign="top" style="height: 30px">
Select department:</td>
</tr>
<tr>
<td valign="top" style="width: 281px">
<select id="GroupSelection" onChange="GroupSelectList"
name="GroupSelection" tabindex="4">
<option value="0"></option>
<option value="group1"> GROUP1 </option>
<option value="group2"> GROUP2 </option>
<option value="group3"> GROUP3 </option>
<option value="group4"> GROUP4 </option>
</select></td>
<td valign="top" style="width: 284px">
<select
id="DepartmentSelection" onChange="DepartmentSelectList"
name="DepartmentSelection" tabindex="5">
<option value="0"></option>
<option value="ACCT">ACCT</option>
<option value="BD">BD</option>
<option value="HR">HR</option>
<option value="MKT">MKT</option>
<option value="PUBLIC">PUBLIC</option>
<option value="STAFF">STAFF</option>
<option value="Helpdesk">HELPDESK</option>
<option value="IT">IT</option>
</select></td>
</tr>
</table>
<p>
<hr>
<span id =spServer></span>
<p>
<span id =spUser></span>
<p>
<span id =spGroup></span>
<p>
<span id =spDepartment></span>
<hr>
<p align="left">
<input id=CreateButton class="button" type="button" value="Create"
name="Create_button" onClick="Create" Disabled=True tabindex="6">
</BODY>
</html> Tag: Create Network Bridge Tag: 206029
Webtable parsing: nested A's in TD's
I am trying to parse an html link inside of a table.
Here is the html I am trying to hook:
<tr class="gray">
<td class="oq_sameOrder"> </td><td class="oq_sameOrder"><a
href="item_query?item=109808113">L9808113</a></td><td
class="oq_sameOrder">NSS.HRPT.NN.D07135.S0859.E0908.B1022222.WI</
td><td class="oq_sameOrder">2007-05-15 13:58:34.0</td><td
class="oq_sameOrder">Pull Ready</td><td class="oq_sameOrder"><a
href="javascript:helpOpen('http://www.class.noaa.gov/download/A6031173/
NSS.HRPT.NN.D07135.S0859.E0908.B1022222.WI')">www </a>
<br>
<a href="javascript:helpOpen('ftp://ftp.class.noaa.gov/A6031173/
NSS.HRPT.NN.D07135.S0859.E0908.B1022222.WI')">ftp </a> </td>
</tr>
I am trying to get the ftp path/filename into a string. I loop over
all TD (each TD named oElement) until I make the following match:
Left(Trim(oElement.InnerText),4) = "NSS."
I then use parentElement and cell indexing to refer to the last cell
in the row:
oCell = oElement.parentElement.cells(5)
My problem is that I can not access the links inside of oCell.Why does
the following not work?:
oTags = oCell.All.Tags("A")
oLinkText = oTags(1).HREF Tag: Create Network Bridge Tag: 206027
Populate a web form with Excel data
I want to have a search box on a web page. The user enters what they
want to search for in an Excel sheet that resides on the server and
the data is populated in a form. There are not more than one record
to be returned. I think you can use VBScript to do this but have
limited experience using it. Can anyone provide an example? Thanks Tag: Create Network Bridge Tag: 206024
rs.RecordCount issue...
hi guys
I'm having a problem with the code below. The SQL statement runs fine and
i've even checked the database in the backgroud and it contains a perfect set
of records waiting to be picked up ... yet the rs.RecordCount funtion is
returning a value which is 1 less than the correct figure. i checked the
database on various instances and see that it always misses the last line, of
the recordset.
anyone have any ideas on how to fix this?
txtRecordset.CursorLocation = adUseClient
txtRecordset.Open "SELECT " & tab35 & ".prefix, " & tab35 & ".Indexing, " &
tab35 & ".extension, " & tab36 & ".Title FROM " & tab35 & " INNER JOIN " &
tab36 & " ON " & tab35 & ".Indexing = " & tab36 & ".Indexing", txtConnection,
adOpenStatic, adLockOptimistic
'msgbox "Check client_DB temp"
'results are perfect in the DB... the recCount value is wrong. not picking
up the last value.
Dim RecCount
RecCount = txtRecordset.RecordCount
TotalRecCount = TotalRecCount + RecCount
--- end. Tag: Create Network Bridge Tag: 206018
How to change the VLK product key
Microsoft provide information how to change the Volume Licensing product key
on a computer that is running Windows XP SP1 and later versions of Windows
XP use VBScript.
http://support.microsoft.com/kb/328874/en-us
How to do the same task but for MS Office 2003 Professional?
Since editing registry manually may cause serious problems if something done
incorrectly.
Could someone provide VBScript?
Regards, Tag: Create Network Bridge Tag: 206015
Win32_Logicaldisk - incomplete drive listing
Hello,
Recently I used the class Win32_Logicaldisk to list all mapped network
drives and found an issue.
For unknown reason some network drives are shown when I run NET USE,
but do not shown when I look for them via a Win32_Logicaldisk
collection.
Here is the output:
*****************************
C:\>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Unavailable K: \\deimos\temp Microsoft Windows
Network
Disconnected R: \\sun\netlogon Microsoft Windows
Network
Disconnected Z: \\sun\c$ Microsoft Windows
Network
The command completed successfully.
C:\>cscript /nologo netdisk.vbs
Drive letter: R:
Drive letter: Z:
*****************************
Here is the netdisk.vbs, very simple, isn't it?
*****************************
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colDrives = objWMIService.ExecQuery("Select * From
Win32_LogicalDisk Where DriveType=4")
For Each objDrive in colDrives
Wscript.Echo "Drive letter: " & objDrive.DeviceID
Next
*****************************
Have anyone had this problem before?
Why it does not work?
Thak you for any ideas Tag: Create Network Bridge Tag: 206007
Check if group exists before creating it
Hi all,
Having "borrowed" this script and modified, it works fine by itself.
I want to use this as part of a loop to create groups and populate
from a file with format group|user
' SimpleGroup.vbs
' Sample VBScript to create a Global Security Group
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.4 - May 2005
' ----------------------------------------------------------'
Dim strOU, strGroup, strDNSDomain
Dim objOU, objGroup, objUser
' Check - Make sure you have the OU referenced by strOU
strOU = "OU=Newport,"
strNewGp = "Coal Porters1"
strNewGpLong = "CN=" & strNewGp
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
' Create new Group
Set objOU = GetObject("LDAP://" & strOU & strDNSDomain )
Set objGroup = objOU.Create("Group",strNewGpLong)
objGroup.Put "sAMAccountName", strNewGp
objGroup.setInfo
Wscript.Quit
' End of Simple Group VBScript.
So if I have a group that already exists, it dies. How can I check
for the existence of a group before objGroup.setInfo? Tag: Create Network Bridge Tag: 206005
Check all files in all subfolders and obtain newest file
Hello all.
What I'm trying to do is the following:
1. Get a list of all files in all subfolders from a starting point
(D:\Test).
2. Get the newest file from this list.
3. Indicate whether this newest file is more than 90 minutes old.
Searching through previous posts, I've used elements of 3 different
scripts to put a new script
together:
'~~~ Create Dynamic Array for Filenames
Dim arrFiles(), i
Redim arrFiles(-1)
sFolder = "D:\Test"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(sFolder)
Set colFiles = objFolder.Files
CheckSubFolders(objFolder)
Sub CheckSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
Set colFiles = objSubFolder.Files
'~~ Populate the array with filenames from each SubFolder
For Each objFile In colFiles
Redim Preserve arrFiles(UBound(arrFiles) + 1)
arrFiles(UBound(arrFiles)) = objFile.Path
Next
'~~ Repeat subroutine until all SubFolders have been checked
CheckSubFolders(objSubFolder)
Next
End Sub
'~~~ From the Array of Filenames get the newest file
Dim vDT, vFName, NewestFile
For i = 0 To UBound(arrFiles)
Set oFile = objFSO.GetFile(arrFiles(i))
WScript.Echo oFile.Path & vbTab & oFile.DateLastModified
IF oFile.DateLastModified > vDT Then
vFName = oFile.Path
vDT = oFile.DateLastModified
End If
Next
NewestFile = vFName
Wscript.Echo vbCrlf & NewestFile & vbCrlf
'~~~ Check if newest file is more than 90 minutes old
Set oFile = objFSO.GetFile(NewestFile)
IF DateDiff("n",oFile.DateCreated,Now) > 90 Then
Wscript.Echo "File is more than 90 minutes old."
END IF
Set objFSO = nothing
Set objFolder = nothing
Set colfiles = nothing
Set colFolders = nothing
Set oFile = nothing
My script works fine, but I'm guessing it could probably be
streamlined and some redundancy
removed. Or, maybe there's a completely different and better method
that can be used.
Any suggestions would be greatly appreciated. Thanks.
- Dave Tag: Create Network Bridge Tag: 206004
Creating an Domain DFS Root link
Hi all,
i used the script
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root
\cimv2")
Set objDfsNode = objWMIService.Get("Win32_DfsNode")
errReturn = objDfsNode.Create _
("\\atl-dc-02\Scripts","\\atl-dc-02","Scripts", _
"New Dfs node for shared scripts.")
but this is creating the DFS root for standalone server but not for
the
"Domain DFS root"
if the value of "errReturn is 0" it means that the dfs kink is
created
but
if a non 0 value is returened it means that the script failed.
so the above script works fine for creating standalone dfs link but
not for
the domain dfs root link
Is there a way we could create a Domain DFS Root link thru script?
if yes pls let me know Tag: Create Network Bridge Tag: 205999
Why did a subroutine fix my problem?
I posted a few days ago about an 800A0046 permissions issue I was
seeing only on a specific server as a specific type of user in regards
to a CreateObject fuction. I saw an example of someone else's FSO
script that used a subroutine to call their createobjects so I thought
I would try it, and it worked! but I don't know why.
Here is the script that bombs with a permissions denied for
CreateObject on line 2 (only for local admins and domain users; for
domain admins it runs fine):
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
MsgBox "Hello World"
Set fso = nothing
Here is the script that runs fine for all users:
Dim fso
sub blabla
Set fso = CreateObject("Scripting.FileSystemObject")
end sub
MsgBox "Hello World"
Set fso = nothing
Any idea why the subroutine fixed the issue?
Thanks! Tag: Create Network Bridge Tag: 205996
Configuring a script, entering values
Hi All!
I maintain a server checking script that we use to perform daily tasks on an
array of servers such as check free disk space, which services have stopped
e.t.c.
I've recently created an installer for this to help make the process a
little easier (since some functions require the use of an exe) which nicely
places all the needed files into a set location. What I'd really like to do
though is this:
The script itself has several variables that must be defined (such as the
servers in the array and the username/password it logs onto each server with
e.t.c.). I'd like to make it so that after the installer finishes it runs
another script (which I can setup in the installer no problem, its the script
I need help with). I'd like it so that this secod script bring up prompt
boxes (or whatever you want to call them) where you can then enter in the
information needed for each variable, so you'd be prompted to enter in the
servers in the array, the username to be used e.t.c. The idea being that
you'd have no actually need to go into the script itself uness you
encountered a problem.
How would I go about doing this? Can it be done through a script or do I
need to do this some other way? Any advice/help would be much appreciated :-)
Thanks,
Sam
--
_______________________________
Sam Richardson
Technical Support Administrator
Central Business Services
________________________________ Tag: Create Network Bridge Tag: 205989
Search for Files by creation date
Hey guys, I'm new to vbs. (Don't they all say that?) I'm trying to automate a
task at work using vbs. Basically, I need a count of files from a folder AND
sub-folders for all .pdf files created today. The path is Z:\C89\ and it
remains constant and the file names are formatted as such: xxxx20070518.pdf,
where the current date + 5 days is embedded into the file name. (I can't get
the wildcard to work-that's why I thought I'd mention it.) Next, I'd like for
the script to send me the results in an email. e.g. "The C89 folder has 50
pdf files" We use Windows Exchange on XP/2003 here. I've tried to piece
together code from different sites, but I always end up with some error. I
don't mind cracking open a book and learning vbs from scratch-which I intend
to do, but I'm up against a deadline.
Regards~ Tag: Create Network Bridge Tag: 205985
Use a style in onmouseover?
Is it possible to "call" or use a style in a DIV onmouseover/onmouseout?
For example:
<DIV ID="SC1" onmouseover=<MY_STYLE_1> onmouseout=<MY_STYLE_2>
Style="border:1px solid #54BC00;">
If so, how do you reference it? Examples much appreciated...
Thanks Tag: Create Network Bridge Tag: 205978
UPnP data readout
Hi,
can somebody suggest me a url to some API information to UPnP and VBS ?
I need to build a script which allows me to a) determine a UpNP capable
router on my net and b) readout some schema information
for example:
um:schema-upnp-org:service:WANPPPConnection:1-> GetExternalIPAddress(String)
I Found this Script to set a port mapping via upnp but have no clue how to
simple read already present information:
'===========================================================
'This program forwards a port via UPnP
Set nat = CreateObject( "HNetCfg.NATUPnP")
Dim mappingPorts
Set mappingPorts = nat.StaticPortMappingCollection
MsgBox("Click OK to forward the port")
'Map the SIP port
mappingPorts.Add 5060, "UDP", 5060, "10.0.0.100", TRUE, "SIP"
'Get some info about the currently mapped ports
for each mappingPort in mappingPorts
MsgBox(mappingPort.externalIPaddress)
Next
MsgBox("Click OK when finished")
'Remove the mapped port
mappingPorts.Remove 5060, "UDP"
'===========================================================
thanks. Tag: Create Network Bridge Tag: 205976
HTA / IE7 question...
Hi, folks!!!
I'm trying to write up an HTA application to do various tasks. I have
included a copy of some code to illustrating one of the things I'm
trying to do. I am to open a PDF report from this HTA script. I have
tried this script on one XP machine with IE6 -- works fine! The other
XP machine with IE7 -- nothin! Both machines have Acrobat Reader
installed.
If I try to open a TXT file using this method I have no problems with
IE6 or IE7.
Does anyone know what gives?!?
===============test.hta===============
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<HTA:Application
border="thin"
borderStyle="normal"
caption="yes"
maximizeButton="no"
minimizeButton="no"
showInTaskbar="yes"
windowState="normal"
innerBorder="yes"
navigable="no"
scroll="no"
scrollFlat="yes"
/>
<script src="VBSlib.vbs" language="VBScript"></script>
<script language="VBScript">
Dim oShell : Set oShell = CreateObject("WScript.Shell")
Dim szCmd : szCmd = Chr(34) & App.Path &"\Report.PDF"""
MsgBox szCmd
oShell.Run szCmd
</script>
</head>
<body>
</body>
</html>
==================================
TIA... Tag: Create Network Bridge Tag: 205970
Check for missing user group in computer account
I need to check each of my computer accounts in active directory for a
specific user group. If it exists move on to the next computer
account, if it is missing add the user group to the computer account
and move on to the next computer account.
The script needs to be for global groups and not local computer
groups. I hope someone can help. Tag: Create Network Bridge Tag: 205969
DSACLS Script to Export Permissions
Anyone have a script or link to export permissions for objects using
DSACLS? If there is another method that would be great as well.
Looking for a method to script out the SELF permissions on all user
accounts to find discrepancies.
Thanks,
James Chong (MVP) Tag: Create Network Bridge Tag: 205961
VBScript BITS
Can the Background Intelligent Transfer Service be configured with VBScript?
I want to set up a job in a log on script. Tag: Create Network Bridge Tag: 205939
Inventory Script
Below is an excellent inventory script I found on www.windowsitpro.com. It
works great but I'd like to add three properties.
1. From the Win32_ComputerSystemProduct, the IdentifyingNumber (the
computer's serial number)
2. From the Win32_ComputerSystem class, the UserName and the
PrimaryOwnerName ( the username on the Computer Systems tab)
Can someone please confirm that the following modifications to the script
would be correct?
1. Win32_ComputerSystemProduct doesn't exist in the script. So , just
before objfile.close, I need to add:
strProperties = _
"IdentifyingNumber"
QueryInstances "Win32_ComputerSystemProduct",strProperties,"None"
2. And I need to add UserName and PrimaryOwnerName to the
Win32_ComputerSystem query like this:
strProperties = _
"CreationClassName,Manufacturer,Model,Name,NumberofProcessors," & _
"SystemType,TotalPhysicalMemory,UserName,PrimaryOwnerName"
QueryInstances "Win32_ComputerSystem",strProperties,"None"
Thanks,
Jeremy
CODE
'On Error Resume Next directive is specified so that users
'are not bothered by potential operational errors with the script.
'On Error Resume Next
'Using both of these flags of the WbemFlagEnum enumeration
'makes a semisynchronous WMI call. See "Making a Semisynchronous Call"
'in the WMI SDK for more information.
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
'WbemCimtypeEnum Enumerations used in the script
Const wbemCimtypeUint32 = 19
Const wbemCimtypeSint64 = 20
Const wbemCimtypeUint64 = 21
'Formatting and number conversion constants
Const HR = "----"
Const KB = 1024
Const MB = 1048576
Const GB = 1073741824
'Change this to the UNC path where inventory files should be created
'Anyone running this script must have read and write access to the
'path.
strInvFilePath = "\\sea-fs-02\hw\"
'If each user will run this inventory file locally, do not change the value
'of strComputer.
strComputer = "."
'Connect to WMI
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'Determine the OS because not all classes listed here are supported
'on all versions of the Windows operating systems
strProperties = "CreationClassName,Version,CSName,Caption"
Set objOS = objWMIService.ExecQuery _
("SELECT " & strProperties & " FROM Win32_OperatingSystem",_
,wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each Setting in objOS
strCreationClass = Setting.CreationClassName
intVersion = Setting.Version
strCSName = Setting.CSName
strCaption = Setting.Caption
Next
'Check for a file named after the computer. If it doesn't
'exist, then create a file that contains the computer's
'hardware inventory.
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFileName = "HrdWrInv_" & strCSName & ".txt"
strFullName = objFSO.BuildPath(strInvFilePath, strFileName)
If (objFSO.FileExists(strFullName)) Then WScript.Quit
Set objFile = objFSO.CreateTextFile(strFullName)
'Write the Operating System name and version but nothing more.
'The goal is to collect hardware inventory, not software inventory
'and configuration information.
objFile.WriteLine("OSInformation:")
objFile.WriteLine("CreationClassName: " & strCreationClass)
objFile.WriteLine("ComputerName: " & strCSName)
objFile.WriteLine("Caption: " & strCaption)
objFile.WriteLine("Version: " & intVersion)
'The name property is automatically returned (because it's a key value), so
'it's not absolutely necessary to specify it in strProperties
strProperties = _
"CreationClassName,Manufacturer,Model,Name,NumberofProcessors," & _
"SystemType,TotalPhysicalMemory"
QueryInstances "Win32_ComputerSystem",strProperties,"None"
'Page file information.
strProperties = _
"Name,MaximumSize"
QueryInstances "Win32_PageFileSetting",strProperties,"None"
'Physical memory information.
'Note, total memory is aggregated and listed with win32_computersystem so
there's
'no need to query the memory classes, such as Win32_PhysicalMemoryArray or
'Win32_PhysicalMemory. However, if you need to find out how much memory
'a computer will hold, it's useful to query Win32_PhysicalMemoryArray as
'shown
strProperties = _
"MaxCapacity,CreationClassName"
QueryInstances "Win32_PhysicalMemoryArray",strProperties,"None"
'SCSI Disk controller information
strProperties = _
"Name,Manufacturer,Description,CreationClassName"
QueryInstances "Win32_SCSIController",strProperties,"None"
'IDE Disk controller information
strProperties = _
"Name,Manufacturer,Description,CreationClassName"
QueryInstances "Win32_IDEController",strProperties,"None"
'Phyiscal Media information
'Note, this class is only in XP (ver5) and the Windows
'Server 2003 family (ver5).
'Win98SE reports a version number of 4 (4.10.2222)
If Mid(intVersion,1,3) >= 5.1 Then
strProperties = _
"SerialNumber,CreationClassName"
QueryInstances "Win32_PhysicalMedia",strProperties,"None"
End If
'Logical Disk information
strProperties = _
"DriveType,Description,DeviceID,CreationClassName"
QueryInstances "Win32_LogicalDisk",strProperties,_
"DriveType!=3 AND DriveType !=4"
'Disk drive information
strProperties = _
"Caption,Description,DeviceID,InterfaceType," & _
"Manufacturer,MediaType,Model,Partitions,Size,CreationClassName"
QueryInstances "Win32_DiskDrive",strProperties,"None"
'Processor information
strProperties = _
"Manufacturer,MaxClockSpeed,ExtClock,ProcessorType," & _
"Revision,Version,CreationClassName"
QueryInstances "Win32_Processor",strProperties,"None"
'NIC information
strProperties = _
"Manufacturer,MACAddress,ProductName,AdapterType,CreationClassName"
QueryInstances "Win32_NetworkAdapter",strProperties,_
"AdapterType='Ethernet 802.3' AND ProductName !='Packet Scheduler
Miniport'"
'Monitor information
strProperties = _
"Description,MonitorType,CreationClassName"
QueryInstances "Win32_DesktopMonitor",strProperties,"None"
'Video adapter information
strProperties = _
"Name,MaxRefreshRate,AdapterRAM,CreationClassName"
QueryInstances "Win32_VideoController",strProperties,"None"
'Motherboard information
strProperties = _
"Description,Manufacturer,Product,CreationClassName"
QueryInstances "Win32_BaseBoard",strProperties,"None"
'BIOS information
strProperties = _
"Manufacturer, Name,SoftwareElementID,SMBIOSBIOSVersion," & _
"SMBIOSMajorVersion,SMBIOSMinorVersion,Version"
QueryInstances "Win32_BIOS",strProperties,"None"
objFile.Close
'*****Subroutines and Functions*********
Sub QueryInstances(objClass,Properties,Conditions)
If Conditions = "None" Then
strSelect = "Select " & Properties & " From " & objClass
Else
strSelect = "Select " & Properties & " From " & objClass & _
" Where " & Conditions
End If
Set objClassName = _
objWMIService.ExecQuery _
(strSelect,,wbemFlagReturnImmediately + wbemFlagForwardOnly)
intCounter = 0
' Can use the following to determine the # of items in the sWbemObjectSet
but
' it's processor intensive and it means that you can't use a
semi-synchronous
' call because the count property doesn't work with wbemFlagForwardOnly.
' WScript.Echo "# of items in collection: " & objClassName.Count
For Each objComponent in objClassName
If intCounter = 0 Then
objFile.WriteLine(HR)
objFile.WriteLine(Mid(objClass,7) & ":")
End If
For Each objProperty in objComponent.Properties_
'Start by verifying that there's a value in the property.
'If not, it isn't necessary to perform the evaluation in this loop.
If ISNull(objProperty.Value) Then
objFile.WriteLine(objProperty.Name & ": Not available")
Else
If objProperty.CIMType <> wbemCimtypeUint32 And _
objProperty.CIMType <> wbemCimtypeUint64 And _
objProperty.CIMType <> wbemCimtypeSint64 Then
objFile.WriteLine(objProperty.Name & ": " & _
objProperty.Value & " " & _
GetUnits(objClass,objProperty.Name))
Else
strUnits = GetUnits(objClass,objProperty.Name)
intValue = _
SizeFormat(objProperty.Name,objProperty.Value,strUnits)
objFile.WriteLine(objProperty.Name & ": " & intValue)
End If
End If
intCounter = intCounter + 1
Next
If intCounter > 1 Then objFile.WriteLine(HR)
Next
objFile.WriteLine(HR)
objFile.WriteLine()
End Sub
Function GetUnits(ClassName,ClassProperty)
Set objSchemaClass = objWMIService.Get(ClassName)
For Each objClassProperty in objSchemaClass.Properties_
If objClassProperty.Name = ClassProperty Then
For Each objQualifier in objClassProperty.Qualifiers_
If LCase(objQualifier.Name) = "units" Then
GetUnits = LCase(objQualifier.Value)
End If
Next
End If
Next
End Function
Function SizeFormat(PropertyName,RawValue,Units)
Select Case LCase(Units)
Case "bytes"
If int(RawValue/GB) >= 1 Then
SizeFormat = Round((RawValue/GB),1) & " gigabyte(s)"
ElseIf int(RawValue/MB) >= 1 Then
SizeFormat = int(RawValue/MB) & " megabyte(s)"
Else
SizeFormat = RawValue & " byte(s)"
End If
Case "kilobytes"
If int(RawValue/MB) >= 1 Then
SizeFormat = Round((RawValue/MB),1) & " gigabyte(s)"
ElseIf int(RawValue/KB) >= 1 Then
SizeFormat = int(RawValue/1024) & " megabyte(s)"
Else
SizeFormat = RawValue & " kilobyte(s)"
End If
Case Else
SizeFormat = RawValue & " " & Units
End Select
End Function Tag: Create Network Bridge Tag: 205927
Call to VBScript fails
Working in an HTA; how can the following code line:
<SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>
in the code below, be made to call a VBScript sub rather than display a
message box? I have already tried many combinations including the obvious:
<SPAN onclick="Test" language=vbscript>Menu Item One</SPAN>
The full code is below:
<HTML>
<HEAD>
<TITLE>Popup Custom Navigation Menu Sample</TITLE>
<SCRIPT LANGUAGE="vbscript">
Set oPopup = window.createPopup
Function contextMenu
lefter = window.event.offsetX+10
topper = window.event.offsetY+10
oPopup.document.body.innerHTML = oContextHTML.innerHTML
oPopup.show lefter, topper, 200, 65, window.document.body
window.event.returnValue=false
End Function
Sub ItemOne
</SCRIPT>
</HEAD>
<BODY oncontextmenu="contextMenu">
<h1>Creating Custom Context Menus with the Popup Object</h1>
Right-click anywhere on the document to see a customized popup navigation
menu.
<DIV ID="oContextHTML" STYLE="display:none;">
<DIV onmouseover=this.style.background="gold"
onmouseout=this.style.background="#e4e4e4">
<SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>
</DIV>
<DIV onmouseover=this.style.background="gold"
onmouseout=this.style.background="#e4e4e4">
<SPAN onclick=msgbox("yyy") language="vbscript">Menu Item Two</SPAN>
</DIV>
</DIV>
</BODY>
</HTML>
Thanks much for your assistance. Tag: Create Network Bridge Tag: 205926
Can a Div take a "Float" position?
Could someone please correct my syntax to set a control to float?
MyDivID.style.position="float"
I get an error using Office 2003; Win XP; and IE 6.
Thanks for your assistance. Tag: Create Network Bridge Tag: 205922
Write to the window
I need to define a one line area of the window in which to write some text
right to the screen; how do I do that and then use a reference to it?
For example, I tried: <Div Name="txtArea"></Div>
Then tried to write to it:
txtArea.Value="Hello"
But of course this failed...
Your examples would be much appreciated...thanks Tag: Create Network Bridge Tag: 205918
date format problem
i need to use datediff to calculate the difference in minutes between Now()
and a date returned from a 3rd party object.
Now() returns the date as: "5/10/2007 7:15:42 PM"
my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
datediff chokes on this. is there any way i can convert that ugly date to
one that datediff can use? please say yes and give me an example
:( Tag: Create Network Bridge Tag: 205915
Script to change password for Local Admin account question
Ok...as my education continues into the world of scripting (still a
infant here), I have some questions.
I need to reset the password of all the local domain accounts on our
servers. I thought a script + GPO would be a handy method.
Since I am pretty new at scripting, I decided to google for some
suggestions and came up with a few interesting things and wanted to
ask some questions here.
First, I found this one from 'The Scripting guy':
Set objOU = GetObject("LDAP://OU=Finance, DC=fabrikam, DC=com")
objOU.Filter = Array("Computer")
For Each objItem in objOU
strComputer = objItem.CN
Set objUser = GetObject("WinNT://" & strComputer & "/
Administrator")
objUser.SetPassword("i5A2sj*!")
Next
You change the OU and Domain as you suggested. Which brings a quick
question. Suppose your OU has spaces. Something like: Server bin
Does that change how you set it up in the script? Do you need to quote
it within the quotes?
That script seems fairly straightforward.
Then I found this one:
'-------------------------------------------------------------------------------
' Initialization - Declare variables
'-------------------------------------------------------------------------------
Dim fsoIn, fsoOut
Dim inFile, outFile
Dim arrComputerNames
Dim objUser
Dim strComputer
Dim newPassword
Dim ErrorOccurred
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const inFilename = "servers.txt"
Const outFilename = "ChangePwdServers.log"
'-------------------------------------------------------------------------------
' Main script
'-------------------------------------------------------------------------------
On Error Resume Next
ErrorOccurred = False
' Insert WARNING here...
Msgbox ("WARNING: This script will change the local administrator
password for every " & _
"computer listed in SERVERS.TXT. If any services are running with
the local " & _
"administrator credentials, those services must be updated, or they
won't " & _
"start on the next boot. For this script to work, you must have
administrative " & _
"privileges on all of the remote computers you are changing the
password for.")
' Get new password
newPassword = Inputbox ("Please enter the new password.")
' Open the input file and skip the header line
Set fsoIn = CreateObject("scripting.filesystemobject")
Set inFile = fsoIn.OpenTextFile(inFilename, ForReading, True)
inFile.Skipline
' Open the log file (append mode) and timestamp the entry
Set fsoOut = CreateObject("scripting.filesystemobject")
Set outFile = fsoOut.OpenTextFile(outFilename, ForAppending, True)
outFile.writeline (Now & vbTab & "Starting script...")
While Not inFile.AtEndOfStream
arrComputerNames = Split(inFile.Readline, vbTab, -1, 1)
' arrComputerNames(0) contains the computer name
strComputer = arrComputerNames(0)
' Connect to the computer\administrator account
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator,
user")
If Err.Number <> 0 Then
outFile.writeline Now & vbTab & "Error connecting to " & strComputer
& " --- " & Err.Description
Err.Clear
ErrorOccurred = True
Else
' Set the password for the account
objUser.SetPassword newPassword
objUser.SetInfo
If Err.Number <> 0 Then
outFile.writeline Now & vbTab & "Error setting password for " &
strComputer & _
"\Administrator" & " --- " & Err.Description
Err.Clear
ErrorOccurred = True
Else
outFile.writeline (Now & vbTab & "Password set for " & strComputer
& "\Administrator")
End If
End If
Wend
' Clean up the environment
outFile.writeline (Now & vbTab & "Ending script...")
inFile.close
outFile.close
If ErrorOccurred Then
msgbox "Script completed with errors. Please check the log file."
Else
MsgBox "Script completed successfully."
End If
Ok...not only is it VERY complex for me, but why the huge need for
code for something like this?
You look at the first one and it seems straightforward and easy. The
second, looks like a lot of extra, possibly unnecessary work.
I thought i'd start here.
Thanks,
Jas Tag: Create Network Bridge Tag: 205914
Odd 800A0046 Permission Denied error
OK, I am no scripting king, but I know when something doesn't make
sense. I have one Citrix server out of four that generates an
800A0046 errors on the CreateObject launching the login script. So I
created a simple script that has objFSO defined:
'On Error Resume Next
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
MsgBox "Hello World"
Set objFSO = nothing
When executed from the suspect citrix server as a testuser with basic
domain user rights, I get Permission denied: 'CreateObject'. Now just
to make sure it wasn't a local rights issue for filer permissions, I
granted the testuser local admin permissions to the server and I get
the same thing. I did install SP6 for for vb 6.0 and that didn't
help.
Got any ideas?
Thanks
Kevin Tag: Create Network Bridge Tag: 205910
cant append to string and use as object
i build a collection by executing a wql query. i need to echo a specific
property, of an instance in a class. this is fine if its all hardcoded. im
passing args to the script so that i can grab any property, class, instance.
the problem is that i cant seem to append anything to the "objItem." in my
for loop
consider this query:
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\somecomputer\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT someProperty FROM someClass
WHERE Name = 'someName'")
the below would work fine:
For Each objItem In colItems
wscript.echo objItem.AvgDiskReadQueueLength
Next
but if AvgDiskReadQueueLength was passed as an argument and stored in
strProp, the below fails
For Each objItem In colItems
wscript.echo objItem. & strProp
Next
i really need this to work. any ideas? Tag: Create Network Bridge Tag: 205904
Auto sizing control to display a path
In an HTA, I need a control or other object that can grow and shrink based on
its contents; I need this to stay on one line; the user cannot edit it, but
it needs to be accessible for read/write from VBScript.
The contents will be a string network path to a folder selected by the user
(I can already do this part), thus the varying lengths needed.
What is the best control/tool to use for this? Can an example for read/write
please be included?
Thank you very much. Tag: Create Network Bridge Tag: 205892
cant make vbscript/outlook work
hi everyone. VERY annoying problem.
i have a script that has to run every 5 minutes and check the contents of an
exchange inbox. the script cannot run on the exchange server so as far as i
know i MUST have outlook installed on the computer that runs the script. (if
this isnt true PLEASE tell me how to do this without outlook)
so we installed outlook and created a profile for the mailbox in question.
the script works fine... but ONLY if we stay logged in. im assuming its
because the logged in user sees only the outlook profiles that THEY created.
so when no one is logged in, it doesnt work.
can someone please explain how i can do this? i either have to do it without
outlook, or with outlook in such a way that when no one is logged on the
script can still access the profile.
and no... i cant leave the server logged on and locked
:( Tag: Create Network Bridge Tag: 205891
vbscript and domain credentials
Using vbscript, is there a way to ask for username and password, and then
run the rest of the task based on those credentials?
What I'm doing exactly is this: I've created a script to allow me to add
domain users to the local admin group on a remote machine or lab of
machines. Unfortunately, in order to run it and have it run properly on the
remote machine, it must be run by someone who already has their domain
account in the machine's local admin group. What I'd like to do is have it
ask me for the machine's local admin acct and password, then, using those
credentials, add the new domain accounts to the local admin group.
Any ideas?
Thanks,
Doug Tag: Create Network Bridge Tag: 205886
Removing non-ASCII characters from a text file.
Hello Everyone,
I am new to VB Scripting. So, please forgive me, if this is basics.
I would like to write a script, which will take a text file as input,
read line by line, replace any non-ASCII characters with '' and send
the result set into a different text file.
I want to replace any character that is not in [A-Za-z 0-9 \.,\?'""!@#\
$%\^&\*\(\)-_=\+;:<>\/\\\|\}\{\[\]`~]
How do I do that?
Any pointers are appreciated.
Thanks,
-Pavan Tag: Create Network Bridge Tag: 205879
Is it possible to create a network bridge using VBScript on a Windows
XP system? I have not been able to find any information regarding
this?