changing Page File size
I'd like to be able to run a script to check on, and change if necessary, the
size of the page file. Does anyone have, or know of, where I can get such a
script? And which "version" is best? (Jscript, vbscript, wsh, etc.)
I'd like something quick and simple for when I service a PC, regardless of
whether or not I change the amount of memory in it.
Thanks in advance,
Tom Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188990
Win32_NTLogEvent and Performance
I'm trying to help out a customer. The simple script below runs very quickly
on a local system however on a remote production server it takes upwards of
40 minutes! Any ideas?
Set colLogFiles = objWMIService.ExecQuery( "SELECT LogfileName FROM
Win32_NTEventlogFile" )
For Each objLogFile in colLogFiles
'Find all the event log entries in that log.
Set colEvents = objWMIService.ExecQuery( "SELECT * FROM Win32_NTLogEvent
WHERE Logfile = '" & objLogFile.LogFileName & _
"' AND TimeGenerated > '" & strThen & "'" )
count = 0
For Each objEvent in colEvents
' Display some information about the event log entry and stop processing
the rest of them.
Wscript.Echo " " & objLogFile.LogFileName & ": Event ID: " &
objEvent.EventCode & "; Time: " & objEvent.TimeGenerated
count = count + 1
If count >= 10 Then
Exit For
End If
Next
Next Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188988
check if file is in use
Hi,
I am looking for a (graceful) method to determine if a file is in use
(i.e., checking if i can delete or move it is *not* an option :) I am
already using the WMI to obtain a list of directories that I need to
check for the file (it is the same one for each directory), so perhaps
I could use that? Anyway, all suggestions are appreciated...
tia,
arno Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188986
Current UTC date and time in a batch environment variable
Simple BAT and VBScript to simulate UNIX date /u. Nothing original, I
just stiched together some stuff from the groups. But have not seen
this particular solution before.
========================================================================
== NowUTC.vbs
========================================================================
Option Explicit
Dim UTC
Dim LocalTZ
Dim TZOffset
For Each LocalTZ in
GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")
TZOffset = LocalTZ.CurrentTimeZone
Next
if TZOffset < 0 Then
UTC = DateAdd("n", ABS(TZOffset), CDate(Now))
else
UTC = DateAdd("n", -ABS(TZOffset), CDate(Now))
end if
Wscript.Echo FmtLZ(Year(UTC), 4) & FmtLZ(Month(UTC), 2) &
FmtLZ(Day(UTC), 2) & FmtLZ(Hour(UTC), 2) & FmtLZ(Minute(UTC), 2) &
FmtLZ(Second(UTC), 2)
Function FmtLZ(NValue, NLength)
FmtLZ = String(NLength - Len(CStr(NValue)), "0") & CStr(NValue)
End Function
=====================================================================
== Test.bat
=====================================================================
@ECHO OFF
:: ------------------------------------------------------------------
:: Run the VBScript and capture its output as the environment
:: variable NowUTC, in the format YYYYMMDDHHNNSS
:: ------------------------------------------------------------------
FOR /F "tokens=*" %%A in ('cscript NowUTC.vbs //nologo') DO SET
NowUTC=%%A
:: ------------------------------------------------------------------
:: As a demo, show NowUTC and how to breakout the parts
:: ------------------------------------------------------------------
ECHO NowUTC env variable is "%NowUTC%"
ECHO The parts of NowUTC are:
ECHO Year = %NowUTC:~0,4%
ECHO Month = %NowUTC:~4,2%
ECHO Day = %NowUTC:~6,2%
ECHO Hour = %NowUTC:~8,2%
ECHO Minute = %NowUTC:~10,2%
ECHO Second = %NowUTC:~12,2% Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188982
how to datatype in VBS?
I want to call a method in the SQLDMO.SQLServer object that happens to be
broken (since 2003). Apparently the problem is that the method expects a
string and not a variant for one of its parameters. The bug description is
here:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q279514
So my question is: how can I pass the method a string? the call that fails
looks like this:
dim msgs
Set rs = db.ExecuteWithResultsAndMessages2(sql, msgs)
and (obviously) this suppresses the abend but does not get me my results
(but it does prove the bug report is correct):
Set rs = db.ExecuteWithResultsAndMessages2(sql, cstr(msgs))
ideas anyone?
TIA - e Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188981
Create Installation File
I have a vbScript file (.vbs) that simply publishes a custom Outlook
form (.oft) into the user's Personal Forms Library. I'd like to create
an installation file that packages both of these files (.vbs and .oft),
and runs the code within the .vbs file when executed.
Is this an easy thing to do?
Thanks,
Boyd Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188979
wmi Win32_LogicalFileSecuritySetting valid path
hello everyone,
i found a script that allows me to view security information about files and
folders
Set objWMI = GetObject("winmgmts:")
Set fssFolder = objWMI.Get("Win32_LogicalFileSecuritySetting='" &
strFilePath & "'")
however this script will fail if the strFilePath has an apostrophe in it
i then attempting to escape the 's by using
Replace(strFilePath, "'", "\'")
or
Replace(strFilePath, "'", "''")
but neither work
does anyone know how to escape the file path so getting the
Win32_LogicalFileSecuritySetting object will succeed
thank you,
abraham luna Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188976
Check Burned Disks For File Errors
Hello all.
We're in the process of backing up some network data onto DVDs. However, the
burner we're using is very flaky, and sometimes the disks don't burn
properly. You can be navigating through the disk with no problems, and then
you'll find a bunch of files that can't be opened. They give you errors like
"Cannot find file" or "File could not be opened". If you re-burn the exact
same files again, it works fine.
These disks have literally thousands of files on them. There's no way for
someone to randomly check files and have any assurance that the disk as a
whole is free of issues.
I'm thinking of building a VBS that will iteratively step through all the
files/folders and check them for errors. The only problem is, I'm not sure
the best way to do this. There vast majority of the files are MS Office
files, so I guess I could simply attempt to open each one within its given
application and make sure there are no errors. However, I don't know how long
that would take when you've got so many files.
Does anyone have any advice for a better method to do this?
--
Hmm...they have the Internet on COMPUTERS now! Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188974
Changing name machine
Hi!
I have no idea about vbs scripting but i need to change from command line
(cscript command) the name and description field, of the several machines. I
found script to change workgroup and it works fine, but i don't find script
to change name machine and description field.
Any one can help me ?
Thanks. Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188969
Printing word-doc to pdf-file
Hi,
I dynamically created a word-document. How do I save it as a pdf-file?
Word and a pdf-printer are installed on the server!
Thx Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188963
Using Menus in WSH Scripting?
Hi,
I'm writing a small vb script that will allow certain users to interact with
a few elements of our AD. I've got the AD interaction working, however one
of the features I'd like if for people to be able to select some options
from a drop down menu. Is this possible? I've read certain articles that say
vbscript/wsh doesn't support drop menus, but these were a few years old. Is
it still true? If so, does anyone have any recommendations for a way around
it?
Cheers
Ben Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188959
Checking for folder existence using widlcards
In my office we have a system for allocating work that involves
creating a subfolder based on a reference number.
The reference number forms a unique part in the format T#nnnnn at the
start of the folder name, the rest of the folder name is freeformat
text with a description of the task (eg "T#12345 - Set up vbscript"). I
am trying to write a script that will check if a folder exists for a
given reference number, if it does it opens it up in explorer and if it
doesn't, it creates the folder and asks the user to input a description
which is then used in the folder name.
The only way I've been able to do it is to get a list of all the
subfolders and loop through each one checking the first 7 characters,
however this is taking quite a while as we have thousands of these
things.
I have split the folders into ranges of 1000 but it still takes too
long to find. What i'd really like to do is to only return folders with
a name of T#nnnn* when I do the getfolder. I can't seem to find any
other method on the filesystemobject that will do this. Wuld be very
grateful if someone could help me. Ta. Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188958
How to check word document?
Dear all.
I would like to create the vbscript which will try to open wor
document and give me the information if it is not possible, if the do
file is unreadable.
Somebode can help me?
Thank you in advance
Thoma
-
SMIEJ7
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188957
retrieving share permissions in NT (Urgent)
hi all,
I need some help in writing a script which can retrieve share
permissions of a folder. This will run on NT machine so i cannot use
WMI service. AdsSecurity is not helpful in dealing with share
permissions.
Can anyone give some other idea of doing this.
Any Script on this can do more good to me Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188955
Local Account
I want to use a script to modify a local account on a computer.
Now, the local account is configed, but the property of the local account is
that "user can't modify the password" and "Password never expires is
disabled". Now I want the property of the local account is that "user can
modify the password " and "Password never expires is now enabled".
Hope some one would help me !
Thanks a lot ! Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188953
Syntax for SQL SELECT Statement with ReadOnly
Someone got into my student file and destroyed one of the feields in it.
I need to change the SELECT SQL statement but just cannot find the correct
syntax.
This is what I have now:
UnivSQL="SELECT * FROM UNVRSTY WHERE NAME = '" & PgName & "' and PASSWRD =
'" & PgPass & "', acReadOnly"
rsUnivs.Open UnivSQL, Cnnct, 3, 3
I was informed to use ReadOnly, but I cannot find where to insert the
property.
Thanks in Advance
Granny Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188941
Retrieving and Converting Octet String in VBS
Hi All,
How can one convert an Octet String attribute to decimal using VbScript?
The particular attribute I'm looking at is msExchSmtpRelayIPList - an
attribute of the SMTP virtual server object in Exchange.
I've gone through the ArrayConvert kba
(http://support.microsoft.com/?kbid=250344), have the Ads.dll from the kba
installed/registered, but had little success with this.
Perhaps there's another way or function someone's using to do this... ?
Thanks!
--
Bharat Suneja
MCSE, MCT
www.zenprise.com
blog: www.suneja.com/blog
----------------------------------------- Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188940
Word- boilerplate text merging?
I searched this group, but still can't find relevant answers.
Is there an easy way to build a Word document based on a template where
I can pick which boilerplate text or images to insert in the given
fields/spots? I found an add-in to Word from ActiveDocs that is very
nice but very pricey. It also seems to do more than I need. I thought
that maybe a VBA script could handle the steps. All I need is a
function that pops a dialog box where I can on the fly select the right
bits of text from a database or maybe txt files on the hard drive. Is
there an existing script that will do it, or alternatively a less
expensive program than ActiveDocs?
TIA Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188934
Search AD using a list of computer names and get OU location
I need to write a vbscript that will search AD using a list of computer
names and give me the OU location for each computer. I have been having
a hard time trying to figure this out. Someone please help. Thanks in
advance Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188927
Countdown Script!
I am looking for some help with a script to bascically count down time. After
about 27 hours I want the script to notify the user with a message to remind
them to log off. It will be a logon script which initiates every time a user
logs in. Can anyone help with this. I don't want to use wscript.sleep because
it is just to crude. Is vbs to weak? Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188921
reading file names, processing them, renaming them
Hi,
I am wondering if anybody can help me with vbscript code for the
following operations:
The script should read all the file names from a folder one by one
(lets say the folder name is c:\test).
For each file name read a process has to occur (I have the script for
the process I need).
After reading the file the file needs to be moved to an "OLD" folder
(c:\test\old).
Then move to the next file.... etc.
Thank you,
Carly Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188917
How to capture PRINT output in ADO?
I'm writing a VBScript to connect to a SQL-Server and execute queries that
contain PRINT statements. I cwant to capture that output... how can I do it?
TIA - e Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188915
Class or WSC?
I'm working primarily in vbscript with wsh.
I have wsf files that do various tasks for me. The wsf files use
fn/subs stored in separate .vbs files by using <script> in the wsf
file. The code is growing and I'm finding the need from my .vbs files
to call other fns/subs. Up to this point I've used a combination of
ExcecuteGlobal, wshell.run and wsf files to pass/return parameters and
call routines. I'm wondering now if I should put all my functions/sub
into a class or a wsc and just reference this one file in all my wsf
programs. The class/wsc would have some disparate functions, but it
seems to suit the purpose. Should I? Which one, class or wsc? Why?
Are there other options to solve my problems?
If you too have question about passing values I highly recommend
looking at Torgeir Bakken's post:
http://groups.google.com/group/microsoft.public.scripting.wsh/msg/9ebc58d1b5f5c51f
He mentions wsc, but not a simpler class. Why?
One of the drivers of my problems is my need to create a cental place
for storing constants. I reference many network paths and I want a
central place to be able to easily make changes. My initial solution
was a text file to hold the constants and a function that uses ado to
look up the values of named constants. But my architecture of calling
vbs files from wsf files didn't work well since now my vbs files needed
to call another vbs function that looked up the constants. You can't
call wsf files from wsf files.
I've looked at wsc and type libaries, but is this overkill for my need
to grab some constants?
Thanks in advance! Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188914
remove first horizontal tab on each line
Hi,
I am using VBScript RegEx on a file to filter it and I wondered if it
was possible to remove only the first horizontal tab on each line?
Aidy Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188906
Does WMI have to be installed on Remote Computer?
Hello. I'm new to WMI, learning as I go. I have a script which is
supposed to check disk space on a number of remote computers.
Sometimes I get an error number back, without a description:
-2147217405. After looking around here, it seems that that means
permission is denied, or it might mean that WMI is not installed on the
remote computer. I'm not sure which. Which brings up the question -
does WMI need to be installed on the remote computer in order for a
script which uses WMI to work? I would have thought it wouldn't since
the script is not being run from the remote computer. Does it?
Another question. If -2147217405 does mean that permission is denied,
I just want to be clear about what exactly that means. Sometimes that
error comes back, but I can log on to that computer and look at the
disk space through a remote desktop connection. So if permission is
denied, how can that be?
My script is below, just in case someone had questions about what I am
doing. And just on a side note, constructive criticism is very
welcome.
Thanks,
Jennifer
On Error Resume Next
Dim CN, RS
Const HARD_DISK = 3
Const CONVERSION_FACTOR = 1048576
Dim
objWMIService,colItems,diskid,freemegabytes,diskspace,totalspace,sInsQry
Dim sErrQry
Dim sErrMsg
Set CN = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.REcordset")
sCon = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=True;Initial Catalog=Server_Disk_Utilization;Data Source=XXXXX"
CN.ConnectionString = sCon
CN.CommandTimeout = 180
CN.Open
sQry = "Select ServerName from Servers"
RS.Open sQry, CN
RS.MoveFirst
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Loop throug the list of servers. Server names are in the
''' Recordset called RS.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Do Until RS.EOF
StrComputer = RS("ServerName").Value
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' First try to ping the server. Server name is in strComputer.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set colPings = objWMIService.ExecQuery _
("Select * From Win32_PingStatus where Address = '" &
StrComputer & "'")
For Each objStatus in colPings
If IsNull(objStatus.StatusCode) _
or objStatus.StatusCode <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If PING does not work, then log it to the errors table.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Err.Number <> 0 Then
Call LogError ("DriveSpace.VBS", "Try Ping", strComputer, Err.Number,
Err.Source, Err.Description)
End If
Else
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If PING does work, then try to create a connection with
''' WMI to the Server.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If the connection does not work, log it to the errors table.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Err.Number <> 0 Then
Call LogError ("DriveSpace.VBS", "Connect to Server", strComputer,
Err.Number, Err.Source, Err.Description)
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If the connection does work, get a list of drives from
''' the server.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set colItems = objWMIService.ExecQuery("Select * from
Win32_logicalDisk " & _
"where drivetype = " & HARD_DISK & "")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If getting the list of drives fails, log it to the errors table.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Err.Number <> 0 Then
Call LogError ("DriveSpace.VBS", "Get Drive Letter", strComputer,
Err.Number, Err.Source, Err.Description)
End If
For Each objItem In colItems
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' If getting the list of drives works, then get the drive space
''' for each drive. Write the drive space to the Server_DiskUsage
''' table.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
diskid = objitem.deviceid
freemegabytes = objitem.freespace / conversion_factor
diskspace = round(freemegabytes,0)
totalspace = round(objitem.size/ conversion_factor)
sInsQry = "Insert Into Server_DiskUsage (" & _
" CollectedDateTime, " & _
" ServerName, " & _
" DriveLetter, " & _
" Capacity, " & _
" Used) " & _
"Values ('" & _
Now & "','" & strComputer & "','" & _
diskID & "'," & TotalSpace & "," &
TotalSpace - FreeMegabytes & ")"
CN.Execute sInsQry
If Err.Number <> 0 Then
Call LogError ("DriveSpace.VBS", "Insert Into Server_DiskUsage",
strComputer, Err.Number, Err.Source, Err.Description & " " & DiskID &
" " & Now )
End If
DiskID = ""
TotalSpace = 0
FreeMegaBytes = 0
Next
End If
Next
Set objWMIService = Nothing
Set colItems = Nothing
RS.MoveNext
Loop
Sub LogError (ScriptName, Location, Server, N, S, Desc)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' LogError Subroutine - logs the errors to the Server_ErrorLog
table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim sCon, CN
sCon = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=True;Initial Catalog=Server_Disk_Utilization;Data
Source=XXXXX"
Set CN = CreateObject("ADODB.Connection")
cN.ConnectionString = sCon
cN.CommandTimeout = 180
CN.Open
If Err.Number = -2147217405 Then
sErrMsg = "Permission Denied"
Else
sErrMsg = Desc
End If
sErrQry = "Insert Into Server_ErrorLog (" & _
" ErrDateTime, " & _
" Script_Name, " & _
" Script_Location, " & _
" ServerName, " & _
" ErrNumber, " & _
" ErrSource, " & _
" ErrDescription) " & _
" Values ('" & _
Now & "','" & ScriptName & "','" & Location & "','" &
Server& "','" & N & "','" & _
S & "','" & sErrMsg & "')"
CN.Execute sErrQry
Err.Clear
CN.Close
Set CN = Nothing
End Sub Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188904
VBScript - ASP Access to SQL SERVER change
I have an ASP page that was done in VBScript
It is setup to read an Access database and I need to change it to read
a Sql 2005 Database.
The code that is used to open the Access Database:
Set adoConnection = server.CreateObject("ADODB.Connection")
Set adoRecordset = server.CreateObject("ADODB.Recordset")
adoConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
Dim strLocation, iLength
strLocation = Request.ServerVariables("PATH_TRANSLATED")
iLength = Len(strLocation)
iLength = iLength - 11
strLocation = Left(strLocation, iLength)
strLocation = strLocation & "../Database.mdb"
adoConnection.Open ("Data Source=" & strLocation)
adoRecordset.ActiveConnection = AdoConnection
In my VB 6.0 app I use the following to open the SQL Database"
Set DataBaseTS_1 = New ADODB.Connection
DataBaseTS_1.ConnectionString ="Provider=MSDASQL.1;Persist Security
Info=False;Extended
Properties=Description=Large Pump Data Source;DRIVER=SQL
Server;SERVER=LPDATASYSTEM\PL3LP;APP=Microsoft Data Access
Components;WSID=LPDATASYSTEM;DATABASE=LargePump;Trusted_Connection=Yes;Initi
al Catalog=LargePump"
DataBaseTS_1.Open
How can I get the VBScript to open the SQL Database?
Thanks,
Bob Hiller
Lifts for the Disabled LLC Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188901
write results to virtual text file
I often use the following to output vbscript results to a temporary text
file so I can cut and paste text from it. Is there a way to make this a
"virtual" text file that never gets written to disk? Perhaps something
similar to ASP's Response.ContentType = "text".
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
InfoFile = FSO.GetTempName
Path = Shell.Environment("Process")("Temp")
FSO.CreateTextFile(Path & "\" & InfoFile, True).WriteLine Details
CreateObject("Shell.Application").NameSpace(Path).ParseName(InfoFile).Invoke
Verb
WScript.Sleep 1000: FSO.DeleteFile Path, True
Set Shell = Nothing
Set FSO = Nothing
thanks
LJB Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188900
Error 800A0046 while running a vbs script on a remote computer
Hey there,
I am trying to make a script that could read an eventlog from a remote
comptuer. I found some code on MS website :
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile " _
& "Where LogFileName='System'")
For Each objLogFile in colLogFiles
Wscript.Echo objLogFile.NumberOfRecords
Next
When using "." for strComputer, everything works fine. If I put a remote
computer, the 800A0046 error appears (Access Denied 'GetObject'). I also
tried the permission "{impersonationLevel=impersonate, (Security)}" with no
success.
Any clues?
Thanks!
Mario Lavigne Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188899
Changing Exchange Folder pemission
All,
I want to add several users to an Exchange PF some as Owners others as
Publisher. Can this be done via script and is there a good sample you can
share?
Thanks,
Rafael Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188898
Copy "Services" file script ??
I need to copy the Services file in \Windows\System32\drivers\etc in all PC
in the domain.The prolem is that regular users dont have permissions to copy
the file.
I tried the Computer Startup Script in GPO but no success.
How can I copy this file through a script ??
Thanks Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188896
Permission Denied on CreateObject
Hi there,
the simple line of code that follows works fine on every
machine that I have tried it on except Windows 2003 Server. I get an error:
Permission Denied: CreateObject.
Set WordApp = CreateObject("Word.Application")
Is it the creation of the COM server, or the CreateObject script call that
is being blocked? What do I need to do to resolve it? Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188895
=?utf-8?B?SUlT5pyN5Yqh5Zmo5aSH5Lu96L2s56e76Kej5Yaz5pa55qGI?=
5LiA5Liq5pyI5Lul5p2l55qE5b+D6KGA5ZWKCklJU+acjeWKoeWZqOWkh+S7vei9rOenu+ino+WG
s+aWueahiCjkuIApCmh0dHA6Ly93d3cuY3VibG9nLmNuL3UvMzA1Mi8/dT1odHRwOi8vd3d3LmN1
YmxvZy5jbi91LzMwNTIvc2hvd2FydC5waHA/aWQ9Nzk0NzcKSUlT5pyN5Yqh5Zmo5aSH5Lu96L2s
56e76Kej5Yaz5pa55qGIKOS6jCkKaHR0cDovL3d3dy5jdWJsb2cuY24vdS8zMDUyLz91PWh0dHA6
Ly93d3cuY3VibG9nLmNuL3UvMzA1Mi9zaG93YXJ0LnBocD9pZD03NTY4Nwo= Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188894
Re: How to make a dynamic file name?
I have not WMI installed for testing .. try :
Set objNetwork = CreateObject("Wscript.Network")
sComputerName = objNetwork.ComputerName
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextfile("c:\" & sComputerName & ".txt", True)
'sComputer = "." ' use . for local computer
'Msgbox sComputer
'''''MyFile.Write InstalledApplications(sComputer)
MyFile.Write InstalledApplications(sComputerName)
MyFile.Close
Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& node & "/root/default:StdRegProv")
sBaseKey = _
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue( _
HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue _
HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = _
InstalledApplications & sValue & vbCrLf
End If
Next
End Function
--
Fosco Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188886
Question regarding shelling out of an HTA to invoke an EXE
I have written an HTA program to facilitate the addition and deletion of DNS
host records using Microsoft DNS. The hypertext make the program user
friendly but the really work is being performed by the imbedded VBScript
code and the DNSCMD.EXE program. Currently, the VBScript sets up some
oshell.run statements involving the DNDCMD.EXE and the program works fairly
well.
My question is this.....
Is there another commands other than oshell.run or oshell.exec to invoke a
command line (non-GUI) program and pipe the output of the program directly
back into the HTA?
Here's what I want and don't want......
I don't want to have to deal with piping output to temp or permanent files.
I want the DNSCMD program to run completely in the background.
I want the output of the DNSCMD program to be it's directly accessible to me
from memory, not in a file that I would have to read.
Any suggestions would be greatly appreciated. Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188882
error when exporting crystal report to pdf using asp
I receive this error when trying to export a crystal report to a pdf
via an asp page...can anyone help? This worked perfectly on Windows
2000 but we have moved it to a Windows 2003 machine and it doesn't
work...
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'session(...).Export'
Any ideas?
Thanks!
Amanda Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188881
IE7. Any word about the affect on vbs.
A recent blurb in pcMag says that IE7 is much more secure than
IE6 ever was, and the major means by which the "improvements"
were achieved was by stifling scripting and actX objects.
Further, it went on to say the IE7 would most likely "break"
(does that mean render inoperable?) a vast number of websites,
and "break" an even vaster number of intRA-net web applications
(leading one to presume that intRA-net apps make a greater use
of scripting than the public websites).
The conclusion was that microsoft was frantically distributing
IE7 betas (or release candidates?) so that their customers could
reprogram their websites and their internal net-based apps to
conform with the requirements of IE7.
It is understandable that microsoft would want to stifle scripting,
those evil and malicious scripters have been giving everybody agita.
However, the customary advice given here to anybody who wishes to
have a scripting GUI is to script yourself up a suitable dialog
using the automation interface to IE6.
So finally, here's the question. Are all those scripts (or hta's)
going to be "broken" by IE7 also???
cheers, jw Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188871
posting here with attachments (follow-up)
A couple of weeks ago, there were some postings here related to
what was allowed in this ng as far as the size of attachments.
I don't know the definitive answer, but I recently tried to post
a message with TWO 40kb attachments, and that was rejected by
the server (grumble).
Then I removed one of the attachments and that one was posted
successfully.
So a somewhat vague answer would be that (at least) up to a 40kb
of attachments is acceptable, but 80kb is not.
hope this helps, jw Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188869
resolve OU current user
Hi,
Can anyone, please, help me with some code. I'm looking for a VB script to
resolve the OU of the current user. This way I want to create the LDAP path
of the current logged in user automatically. Anyone some ideas?
Best regards,
Jerry Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188862
Error running scripts against W2K3 boxes.
In the script below and all other scripts I have that I run against Win2k3
boxes I get an error. The error is:
Line: 33
Char: 1
Error: Permission denied:'GetObject'
Code: 800A0046
What am I doing wrong.
'--------------------------------------------------------------------
' This script looks for a CSV file in the same directory as this script to.
' pull server names from.
'--------------------------------------------------------------------
Dim fsoIn, fsoOut
Dim inFile, outFile
Dim arrComputerNames
Dim objUser
Dim strComputer
Dim ErrorOccurred
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const inFilename = "servers.csv"
Const outFilename = "STARTTelnet.log"
'On Error Resume Next
ErrorOccurred = False
' Open the input file and skip the header line
Set fsoIn = CreateObject("scripting.filesystemobject")
Set inFile = fsoIn.OpenTextFile(inFilename, ForReading, True)
inFile.Skipline
While Not inFile.AtEndOfStream
arrComputerNames = Split(inFile.Readline, vbTab, -1, 1)
' arrComputerNames(0) contains the computer name
strComputer = arrComputerNames(0)
'--------------------------------------------------------------------
'This section sets up the information.
'--------------------------------------------------------------------
'THIS IS LINE 32 the one below is the one I'm havin' trouble with!!!
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\sp1\sp1.exe" , "\\" & strComputer & _
"\c$\SP1\sp1.exe", OverwriteExisting
'Next
Wend
Wscript.Echo "Done" Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188861
script for sharedtemplates location
I need to move the location of the sharedtemplates to another server and need
a script to automate the change for users. I know how to change the location
in office and the registry, however, with over 400 workstations spread over 5
locations, a manual process just doesn't seem efficient. Help...Please. :-) Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188859
Exporting datagrid contents to Excel using ASP.NET
Hello,
I am attempting to export the contents of a datagrid on my webform (using
Excel automation) through ASP.NET.
I have added the Excel object library to my VS ASP.NET project but I am lost
on how to export my datagrid contents to Excel?
I am sure it can be done but having difficulties figuring out the code.
Any help would be greatly appreciated.
Thanks,
Mike Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188858
redirecting stdout??
hi all, I need to redirect stdout to a file within a VBS script I need to
do this because I'm forced to use this SQL-DMO method:
http://msdn2.microsoft.com/de-de/library/ms141159(SQL.90).aspx
...which does not allow capturing of its stdout, since the one I need:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q279514
is broken (and has been since 2003). a response would be great!
- erick <e@arix.com>
p.s. in Ksh this would be so easy... I don't remember the syntax exactly but
it would be something like: exec > /tmp/myfile Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188855
Servers Status Monitor
Hi all.
I have writern a script which shows the online status of the all
servers which i have configured in the database, which includes Disk
space, Services status, Anvivirus stastus (Macfee), Processor usage.
Like how it synchronises with the server and show the status.
Please contact me on srikanth.vemu@gmail.com, whoever wants the script.
Regards,
Srikanth.V
Senior Systems Administrator,
HSBC. Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188854
Advice on working script
Hi,
I would welcome any comments on this script - it works and does what I
want it to, but I'm interested if any of the syntax is dodgy.
The script it intended to copy a file over from a location to another
location, and if the file already exists, check if the user wants to
overwrite.
Many thanks in advance
Script
-----
' Script to copy over the email signature
'get current user, put it in a string
Dim strUsername
Dim strBoo
Dim intResult
Const OverwriteExisting = TRUE
set strBoo = createobject("WSCRIPT.Network")
strUsername=strBoo.Username ' gets currently logged in username
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Check for files and prompt user to overwrite if it exists
If objFSO.FileExists("C:\Documents and
Settings\"&strUsername&"\Application Data\Microsoft\Signatures\sig.txt")
Then
intResult = MsgBox("You already have the signature files. Do you wish
to overwrite?",4,"email signature")
if intResult = vbNo then
WScript.Quit
else
MsgBox ("End of script")
objFSO.CopyFile "J:\sig.txt", "C:\Documents and
Settings\"&strUsername&"\Application Data\Microsoft\Signatures\",
OverwriteExisting
End If
else objFSO.CopyFile "J:\sig.txt", "C:\Documents and
Settings\"&strUsername&"\Application Data\Microsoft\Signatures\",
OverwriteExisting
end if Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188853
Script for adding/removing local user accounts on servers
Hello,
I have a need to maintain exact copies of local user accounts between
two Win2k3 member servers. I cannot use AD; the accounts must be
local.
I'm looking for a script that will create/delete user accounts on both
servers. In addition, when a PW needs to be updated it will change it
on both servers.
I'm vbScript "savvy" so I'm looking for a good headstart if someone
else is doing something like this already.
Thanks!
Troy Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188849
hot to round time to next day, next week or next month?
Hi Guys:
I have a scheduled task, should be run at every day, or every
first day of next week, or every first day of next month (from now).
I'm wondering if it's possible that:
Given today = March 13, 2006
Then URoundWeek(today) == March 20, 2006
URoundMonth(today) == April 1, 2006
Thanks in advance. Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188845
Folder/Sub-folder contents to a DB
Hello all, just wondering if I can can get some help here.
My company just purchased an EMR (Electronic Medical Records) system and we
need to perform a mass scanning offsite. The vendor is asking us to scan
patient files this way. The top folder is the patient account number the sub
folders contains the tabs where we want the files to be stored on the EMR
database and then inside of these sub-folders we will be scanning all the
files. What I need to do is to create a script that can monitor a Hard Drive
for all top folders (Account #'s) and all sub-folders and files and store the
folder names and file names into a databse for each top folder (account #).
Each database entry will need to have the account#, Tabname, filename. Once
Everything is scanned and the databse knows the location of all the files we
will then give an .csv file to the vendor with all the databse entries plus
the hard drive for a complete import to their system. I've looked everywhere
to see how can I accomplish this. So basically I will be creating folders
manually on the Hard Drive conataining the patients account#, the sub-folders
containing the tab names and then inside of the sub folders that's where the
scanned files will be. As for my database for the mass scanning it will be
an Access or SQL db containing only a table with pt_account,pt_tab,pt_image.
Any help would be greatly appreciated.
Thanks, Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188840
how to resolve Microsoft VBScript runtime error '800a0006'
Hi all,
I'm using the following bit of code to try to convert some date fields
to the epoch equivelant, but getting the error:
Microsoft VBScript runtime error '800a0006'
Overflow: '[number: 1142289086]'
/test.asp, line 25
After it hits a certain value. Here's the asp I'm using:
<html>
<head>
<title>Result of Database Query</title>
</head>
<body>
<h1>Result of Database Query - ASP/VBScript</h1>
<%
set myconn = server.createobject("adodb.connection")
connection = "helpdesk"
myconn.open (connection)
set result = server.createobject("adodb.recordset")
result.PageSize = 50
sql = "SELECT id,create_date,lastupdate FROM ooz_tickets"
set result = myconn.execute(sql)
if not result.EOF then
response.write("<p>Data:")
response.write("<table
border=2><tr><th>ID<th>create_date<th>lastupdate<th>newcd<th>newlu")
while not result.EOF
response.write("<tr><td>" & result("id"))
response.write("<td>" & result("create_date"))
response.write("<td>" & result("lastupdate"))
oldid = result("id")
newcd = DateDiff("s", "01/01/1970 00:00:00", result("create_date"))
newlu = DateDiff("s", "01/01/1970 00:00:00", result("lastupdate"))
response.write("<td>" & newcd)
response.write("<td>" & newlu)
result.movenext()
wend
response.write("</table>")
else
response.write("<p>No Entry for " & request("place"))
end if
%>
</p>
</body>
</html>
Line 25 is: newcd = DateDiff("s", "01/01/1970 00:00:00",
result("create_date"))
I'm assuming DateDiff() can't handle numbers greater than some specific
value. How can I get around this, or is there a different way to
convert the date values to epoch?
TIA Tag: Open many *.tsv files in folder and import the data into Excel Tag: 188837
I would like to import each tsv file as a separate sheet in same excel
workbook. Is there any way to do it?