VBScript for WMI - IMF Counters
Does anyone know how I can use VBScript to get WMI counters for the
Intellengent Message Filter (Exchange 2003 SP2)? Thank you.
- Gabe Tag: Folder access / User Tag: 190011
Reading Event Logs
I have a vbscript that processes the event logs on several remote
servers, compares the collection against a event list to report and
another list of excludes to ignore. It works very well on all but one
server server in our company and it looks like the connection is
hanging. I added a echo statement to show me how many events were
being returned from the 24hr window query but it never seems to get the
collection.
My question is is there a way to set timeouts on WMI queries and/or
understand what is making this server look like it hangs?
Thanks for any help.
Dale Tag: Folder access / User Tag: 190010
Is there a size limit to text input?
Hello to all. I hope this is posted in the correct forum. If not, m
apologies, and please correct me.
I'm very glad to have found you. I'm actually a Flash developer, whic
increasingly seems to mean I'll be asked how to do Everything.
A client wants to build a form in .NET which allows users to paste ver
large blocks of text into input fields. People have mentioned 'tex
fields' and 'textareas'. So I need to know:
1] is there a difference?
2] what is the capacity of each?
3] Not for nothing: is there a constant 'max number'?
Thanks,
Pau
-
freedmani
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: Folder access / User Tag: 190003
Delete selected rows in Excel
Hello,
In the below code lines I get a type mismatch error message when I try
to use variables inside
the quotes, I need to programmatically stuff in variables if my script
is going to work, like this
objExcel.Rows("intRow:intLastRow).Select() 'Doesn't work.
objExcel.Rows("44:91").Select() 'Works.
objExcel.Selection.Delete
Seems only regular numbers works inside the quotes.
Any idea of what to do ?
TIA
Svein,Oslo Tag: Folder access / User Tag: 190001
Recursing through folders without changing Last Accessed Date
HI all,
I am writing a script which should enumerate the Folder
permissions of a share. I was successful in doing this until i get a
new requirement which says that the Last Accessed dates should not be
changed.
I am using for each subfol in fol.subfolders to get
the subfolder properties (i.e, Path,size) but what i believe is, it is
the culprit which is changing the date. I tried using
Directory.GetDirectory to get the subdirectories but that attempt also
went into vain as it is also doing the same thing.
I tried using GetLastAccessTime and SetLastAccessTime for setting the
earlier time but to give the path as input i need to get it by using
fol.subfolder property only.
Please suggest me in this regard . I need some alternate solution for
this Tag: Folder access / User Tag: 189995
Excel SaveAs Fileformat
I have a script that starts up Excel, opens a CSV file, does a bunch of
stuff to the contents, and then I want to save the results as a normal Excel
workbook. Everything works great except the SaveAs part.
Here is the line:
objExcel.ActiveWorkbook.SaveAs "Foobar.xls", xlNormal
The error is "SaveAs method of Workbook class failed"
I've tried a number of random variations on the theme, to no avail.
Any suggestions would be greatfully received. Thanks! Tag: Folder access / User Tag: 189989
How to List Folder Permissions
Hi All,
I need to do a vbcript program to list the permissions to an specific folder
on a 2003 server. I am a beginner vbscripter and could'nt find a sample fo
that anywhere else...
Any hint on how can I do that?
Thanks to all! Tag: Folder access / User Tag: 189981
Include Mechanism
Hello world,
in a .vbs script, how can I use functions that are defined in another .vbs
file?
Is there an equivalent to #include in C?
Should be a rather simple question, but i haven't found anything about
this...
Jens Tag: Folder access / User Tag: 189979
Import/Export email addresses
Is it possible to write a script which can read .wab (Windows Address
Book) file?
I have 8 .wab files on my computer. I want to extract email addresses
from those files and put it in a notepad file. Is this possible? Tag: Folder access / User Tag: 189978
Install Updates Not Working... Help!
Hi All,
I am trying to use my logon script to do the ms updates (I am beginner
vbscripter...) . I got a script from MS which seems to work pretty fine for
identifying the necessary updates and another script to do the actual
installation (below). The problem is that the installation does not actually
occurs and the resultcode property shown in the last line is set to 4. I rode
that anything <> 0 is an error which would explain that but I have no idea of
what result code "4" means...
Would anyone knows what code "4" means or, even better, have a list of
result codes and descriptions? (or even better... have a script that works?
I've seen Mark F's post and its just to much complicated for me...
maximilliand code is no longer acessible)
Thanks in advance!
Set objCollection = CreateObject("Microsoft.Update.UpdateColl")
Set objSearcher = CreateObject("Microsoft.Update.Searcher")
Set objResults = objSearcher.Search("UpdateID='" &id &"'")
Set colUpdates = objResults.Updates
objCollection.Add(colUpdates.Item(0))
Set objInstaller = CreateObject("Microsoft.Update.Installer")
objInstaller.Updates = objCollection
Set objInstallResults = objInstaller.Install
Wscript.Echo objInstallResults.RebootRequired
Wscript.Echo objInstallResults.ResultCode Tag: Folder access / User Tag: 189976
run vbs file as administrator
It took me hours of work. ie. im st00pid, but here it is.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\VBSFile\Shell\runas\command]
@="wscript.exe \"%1\"" Tag: Folder access / User Tag: 189969
InStr Always Returns 0....
I've been beating on this script for the past day and am getting some
very odd results. I'm pulling a users' group associations from AD and
matching it to a known group so I can map drives accordingly. I am
pulling the group names easily enough but I can't seem to get a match.
I am printing out the value of the groups string and the group match
string but I always get a 0 from InStr. Can someone tell me what I'm
doing wrong here?
When debugging the print out of strGroup is always
"cn=owners,cn=users,dn=domain,dn=com"
and OWNERS_GROUP is always "cn=users"
I can't figure out why I can't match OWNERS_GROUP to part of the string
in strGroups...
TIA
Dim objNetwork, objUser, CurrentUser, strGroup, GroupList, colGroups
Dim OWNERS_GROUP, STAFF_GROUP
OWNERS_GROUP = "cn=owners"
STAFF_GROUP = "cn=staff"
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
colGroups = CurrentUser.memberOf
If IsEmpty(colGroups) Then
strGroups = ""
ElseIf TypeName(colGroups) = "String" Then
strGroups = LCase(colGroups)
Else
strGroups = LCases(Join(colGroups))
End If
'WScript.Echo " Groups: "& strGroups
'WScript.Echo " Groups Str: "& OWNERS_GROUP
'GroupList = "" & CurrentUser.MemberOf
'Response.Write GroupList
'strGroups = LCase(Join(GroupList))
pos=InStrRev(strGroup, OWNERS_GROUP)
WScript.Echo " Pos: "& pos
' Extra code just to add a message box
'WScript.Echo " Launch Explorer, check: "& strDriveLetter
If InStrRev(strGroup, STAFF_GROUP) Then
wshNetwork.MapNetworkDrive "s:", "\\server\public"
ElseIf InStrRev(strGroup, OWNERS_GROUP) Then
wshNetwork.MapNetworkDrive "o:", "\\server\private"
wshNetwork.MapNetworkDrive "s:", "\\server\public"
End If Tag: Folder access / User Tag: 189962
Dictionary Item() does not like objects?
The following sample does not work:
class clsX
public m1
public m2
end class
set objDict = CreateObject("Scripting.Dictionary")
set w = new clsX
w.m1 = "foo"
w.m2 = "bar"
objDict.Add "0", w
w.m1 = "FOO"
w.m2 = "BAR"
objDict.Item("0") = w 'Object doesn't support property or method
objDict.Item("0") = "fubar" 'Works OK
The line "objDict.Item("0") = w" produces the error:
Object doesn't support this property or method.
Remove that line and the subsequent line "objDict.Item("0") = "fubar""
works just fine.
The Item() method/property only permits string variants to be assigned
to it? Tag: Folder access / User Tag: 189959
read text from html table cell containing and anchor tag
Is there a property of an html anchor tag that contains the anchor's visible
text? I need to sort an html table but one of the columns contains links. I
want to sort on that column by its text not by the href contained in it.
Below is a bit of code the sorting routine currently uses but doesn't quite
do what I want.
... = findFirstLinkChild(row1.cells[column]).href
thanks
LJB Tag: Folder access / User Tag: 189957
RegExp without duplicate matches
I using the following to create hyperlinks of every 7 digit number in an
html table. The problem is there are some duplicate numbers and they create
href's within href's. How do I get rid of the duplicates in a matches
collection before I use vbscript's replace function? I first thought of
using regular expression's replace method and sub-matches but wasn't
successful. The desired result is given 1234567 create
href="./7/1234567.shtml"
sub MakeHyperlinks(strTable)
dim match, regEx
set regEx = Server.CreateObject("VBScript.RegExp")
regEx.Global = True
regEx.Pattern = "\d{7}"
for each match in regEx.Execute(strTable)
strTable = Replace( _
strTable, _
match, _
"<a href=""./" & right(match,1) & "/" & match & ".shtml"">" & match &
"</a>")
next
set regEx = nothing
end sub
thanks
LJB Tag: Folder access / User Tag: 189949
Read folder/file security
Hi,
Can anyone tell me how I can read the security settings of a local
folder and file with vbs?
Thx. Tag: Folder access / User Tag: 189933
Renaming Computer AND Join a Domain
Hello all,
I want to rename a computer and then join the domain WITHOUT a reboot
This code works BUT The Account created on the domain uses the old computer
name (but the DNS Name field is using the new name).
Do I have to use the MoveHere method of ADSI to apply the new name to the
account or there is a better way?
'************** RENAME **************
NewName = "VBTest"
Set objWMIService = GetObject("Winmgmts:root\cimv2")
For Each objComputer in objWMIService.InstancesOf("Win32_ComputerSystem")
objComputer.rename(NewName, NULL, NULL)
Next
'************** JOIN DOMAIN **************
strDomain = "ActiveDirectory"
strPassword = "password"
strUser = "username"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject _
("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer & _
"\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
objComputer.JoinDomainOrWorkGroup(strDomain, strPassword, strDomain & _
"\" & strUser, NULL, 1 + 2) Tag: Folder access / User Tag: 189931
Record URL in database
I have a file that has table with 5 rows and 5 columns. I have named
this file as index.asp on the IIS Inetpub directory.
Every cell in this table has a onclick event. Whenever user clicks on
any cell out of these 25 cells in the table, a new window opens. I want
to capture this url and put it in the MS Access database (The database
has just one field - URL). In short, I want to see which cell get most
number of clicks.
The reason why I just don't want the click count and want to record the
URLs because today the first cell will open a website and tomorrow
there would be a different website on the same cell.
What vbscript code do I have to write and how will I link it to the
tables? Tag: Folder access / User Tag: 189921
Problem walking through Radio buttons
For intPosIdx = 0 To Document.formname.fieldname.length - 1
If Document.formname.fieldname(intPosIdx).checked Then
blnSelFd = "Y"
Exit for
end if
Next
However, if there is a single radio button this code fails. I my scenario
1-n radio buttons may be available. How do I code to take care of the single
button scenario also?
--
---------------------
Thanks
Rajiv Das Tag: Folder access / User Tag: 189920
Question Enumerating scheduled job.
I am aware that we can use w32_scheduledjob class to enumerate the task
scheduler's job. However, this is only for jobs that are scheduled using the
"at" command. Is there way to enumerate for those scheduled jobs created with
the wizard ?
Thanks. Tag: Folder access / User Tag: 189914
Script to configure DNS
I am trying to write a script to un-check the DNS box "Register
Connection's Addresses in DNS" on a windows XP Professional workstation.
It is changing the wring box. Does anyone have the code to accomplish
this task?
Thanks in advance.
Ray Tag: Folder access / User Tag: 189912
Delete files in a folder
Hello,
In the scriptcenter of MS I found a little script to remove all files
from a folder. It works perfect except when there a files in that
folder that are in use. In that case the script crashes with a
RT-error: Access denied - code 800A0046.
The directory I need it for must be cleaned up everyday but there are
always files of the current day in use.
Could someone help me to modify the current script so it will cleanup
all files except the one's in use.
The current script is:
Const DeleteReadOnly = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("F:\webMethods\IntegrationServer4\logs\*.*"),
DeleteReadOnly
Thanks
Frank
--
FVG
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: Folder access / User Tag: 189907
Bonkers
Hello,
I sure hope someone can pull my head out...
OK, I have a USB device that I want to see if its present or plugged
in. Now, this works fine, using cscript on the client as a VBS:
**********************************************************
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strValue = "Device Not Found!"
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity
WHERE service = 'HidUsb'",,48)
For Each objItem in colItems
strKeyPath = "SYSTEM\CurrentControlSet\Enum\" & objItem.DeviceID
Next
if len(strKeyPath) > 1 then
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
strEntryName = "LocationInformation"
objReg.GetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath,
strEntryName, strValue
end if
Wscript.Echo strValue
**********************************************************
When the device is attached objItem.DeviceID returns a portion of the
registry KEY, and I get the value from the registry
LocationInformation. When unplugged I get Device Not Found!
Wonderful, works great.
Problem...
How would I do this using ASP and client side scripting? IIS6.0 would
be the host of the ASP, clients are Windows XP Pro.
Nothing fancy, just a response.write to the clients browser with whats
contained in strValue.
Thanks
ninefofo Tag: Folder access / User Tag: 189906
Problem Using ObjUser.Title with WinNT://
Hello,
I am trying to update Title information of multiple users using following
script. I would like to know what would be the correct namespace/object which
I need to use with WinNT:// for ObjUser.Title. It seems ObjUser.Title is
compatible with LDAP:// and not with WinNT://. When I run the script I get
-2147463153 error. Password change at next login setting works fine. I did
Google for the same but did not find anything helpful. Hoping I might get
some help here.
--------------------------
Function IsAccountDisabled( strDomain, strAccount )
Dim objUser
Set objUser = GetObject("WinNT://" & strDomain & "/" & strAccount & ",user")
IsAccountDisabled = objUser.AccountDisabled
End Function
Dim strUser, strDomain, objUser, fso, tf, tf1, strTXT
strTXT = Replace(CStr(Date),"/","-") & "_"
strTXT = strTXT & Replace(CStr(Time),":","-")
Set fso = CreateObject("Scripting.FileSystemObject")
Set tf1 = fso.CreateTextFile("\\somepath\" & "Done_" & strTXT & ".txt", True)
Set tf = fso.CreateTextFile("\\somepath\" & "Errors_" & strTXT & ".txt", True)
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("D:\somepath\UserInfoUpdate.xls")
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
On Error Resume Next
strAccount = objExcel.Cells(intRow, 2).Value
strDomain = "my.domain.com"
Set objUser = GetObject("WinNT://" & strDomain & "/" & strAccount & ",user")
If (IsAccountDisabled(strDomain, strAccount) = -2147022675) Then
'Wscript.Echo Err.Number
tf.WriteLine( "UserName - " & strAccount & " dosn't exist or there is a typo
in the username.")
Else
'Wscript.Echo Err.Number
tf1.WriteLine(strAccount & "'s account properties have been updated.")
objUser.PasswordExpired = 1
objUser.title = cstr(objExcel.Cells(intRow, 5).Value)
Wscript.Echo Err.Number
objUser.SetInfo
End if
intRow = intRow + 1
Loop
objExcel.Quit
-------------------------------------------------- Tag: Folder access / User Tag: 189901
Changing IE Settings
I'm attempting to write an HTA that to allow users to toggle the IE proxy
server between one of two servers we use or toggle it between enabled and
disabled. We have IE setup so proxy settings are per machine so, as far as
I can tell, that should put me addressing only these two keys...
(string) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyServer
(dword) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyEnable
I can change the keys with a script, but when I go into the browser and
drill down through the tools menu the changes don't appear.
Anyone know why that is?
Thanks,
Tom Tag: Folder access / User Tag: 189898
Convert Win32 error code to text
Hi all,
How do I convert a win32 error code into either the error macro or the
error description in a VBS applet? For example, if I input 32, I want
it to output ERROR_SHARING_VIOLATION, or "The process cannot access the
file because it is being used by another process." (The former
ideally.) I know I could have the winerr.h file handy and parse that,
but I'm sure there must be an easier way.
Cheers
Mark Tag: Folder access / User Tag: 189894
Script to create environment variable containing serial number
I am trying to write a simple script to query the BIOS for the system serial number, then save that to an environment variable (unless blank). My knowledge of scripting is very limited so my my progress has been pretty slow. Does anyone have some tips or sample scripts that may get me on the right path?
Thanks! Tag: Folder access / User Tag: 189888
Detect valid URL from within a webpage
I have a website that uses iframes, within one of these iframes, I have a
HTML form that asks for a user input.
The frame is then updated with a page based on the users input.
example
User is asked to enter a Customer Number - i.e. 12345
The iframe is then loaded with the webpage -
/customer/12345/index.htm
If the customer number is invalid, I get a 404 error returned, as it cannot
find the page. I am unable to have custom error pages, so would like a way
of checking if the link exists first and then loading either the correct
page or a failure page into the iframe.
Any help greatly appreciaed.
I am currently using the following code
<script language="vbscript">
sub chkpass
dim sPwd
sPwd = document.mainform.password.value
window.location = "customer\\" & sPWD & "\\index.htm"
end sub
</script>
<body>
<form name="mainform">
Cutomer ID : <input name="password" type="text" value="">
<INPUT name="button" onClick="chkpass" type="button" value="Go">
</form>
</body> Tag: Folder access / User Tag: 189887
help with if logic problem
I wrote a script that gets the MAC addresses of a vendor device. The problem
I encounter is the process can return 2 or three MAC addresses. I know that
two of them are always bogus.
For example,
When I run the process it returns
010203040506(bogus)
00157010f99C(valid) -will be different based on device.
000000000000(bogus)
The valid MAC seems to show up in first, second or last , so using a Left or
mid will not work.
I don't know how to go about the logic , when I come across the two bogus
MACS to still continue. IF I come across 000000000000 or 010203040506 still
continue. OR if it so happens a valid MAC is first, store that MAC and exit
process. Tag: Folder access / User Tag: 189884
Change Value Data in Script
I need help with a script for about 3000+ PCs, the value I am trying to
change is in regedit. But will be different for each workstation it
touches. The value I am trying to change is that of network printers
which is going to be different for it PC.
The string Im editing is
"PNAME" = "\\server\printer,0"
To
"PNAME" ="\\server\printer,1"
So basically all I need to do is switch the 0 to a 1 on the printer
options. I have scripts to change the whole thing but none to change
if the printer is going to be different everytime.
Any Suggestions would be helpful? Tag: Folder access / User Tag: 189875
Script to ping specific hostnames
I am looking for a script (or utility) that will import a text or CSV file
of multiple hostnames, ping them, and then output the results to a text or
CSV file. Anyone have anything like this?
Thanks very much in advance,
Phil Tag: Folder access / User Tag: 189872
Targeting VBScript to rename PCs
I am working on a project to clean up our AD environment. I am working on
three initiatives: Remove aged accounts, Move Computers to the correct OU
based on subnet, and rename all computers with predefined designation and
last 7 characters of the serial. I am not a very good scripter but I have
managed to pull off the first two. I have the script for the last one working
but not in the automated fashion I need. I can run it against an inputbox for
the target but I really need to run it against a text list of computers. So
basically I need helpwith an array that pulls from a list of targets . I have
found some info but am having trouble getting it to work.. Below is the
current functional script minus any arrayâ?¦ My eventual plan is to have a text
box at start of the script that asks if it should prompt for single target or
run against pre set text fileâ?¦ any help would be appreciated.. Thank you
'On Error Resume Next
'*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'Rename PC and domain machine account
'4/5/2006 Added WMI variable creation for new name
'Added reboot
'*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'#####################################################
'Variables
'#####################################################
Dim sNewCname
Dim sOldCname
Dim StrUsername
Dim StrPassword
Dim StrFullSer, StrTrimmedName
sOldCname = InputBox("Enter computers current name")
StrUsername=InputBox("Enter Domain Username:")
StrPassword=Inputbox("Enter Domain User Password:")
'********************************************************
'Create Function
'********************************************************
Function Rencomp()
'#####################################################
' WMI pull serial and append to pre set name
' WMI pull serial and create new name added 4/4/06
' Trim serial to right 7 and append preset
'#####################################################
msgbox ("sOldCname: " & sOldCname)
Set objWMIService = GetObject("winmgmts:\\" & sOldCname & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Systemenclosure")
For Each objItem in colItems
StrFullSer= objItem.SerialNumber
next
'msgbox ("StrFullSer: " & StrFullSer)
StrTrimmedSer = trim (StrFullSer)
'msgbox ("StrTrimmedSer: " & StrTrimmedSer)
sTrimmedName = Right(StrTrimmedSer, 7)
'msgbox ("sTrimmedName 7 : " & sTrimmedName)
sNewCname = ("NUSEGLLU" & sTrimmedName)
'msgbox ("sNewCname Complete: " & sNewCname)
'#####################################################
'create Shell
'#####################################################
'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
'#####################################################
'Rename PC
' yesno to commented out after addition of array
'#####################################################
yesno = MsgBox _
(sOldCname & " will be renamed to: " & sNewCname, _
vbYesNo, "Script continue")
if yesno = 6 then
Call WSHShell.Run("cmd.exe /k NETDOM RENAMECOMPUTER " & sOldCname & "
/newname:" & sNewCname & " /userd:" & StrUsername & " /passwordD:" &
strPassword & " /force ")
'#####################################################
' Reboot PC
'#####################################################
WScript.Echo "Rebooting..."
set objWSHShell = WScript.CreateObject("WScript.Shell")
objWSHShell.LogEvent 0, "Computer renamed from: " & sOldCname & " To: " &
sNewCname
objWSHShell.Run "shutdown.exe -r -m \\" & sOldCname
else
Msgbox "Rename Aborted!"
end if
'********************************************************
end Function
rencomp
--
System Admin Tag: Folder access / User Tag: 189865
How to identify W2k versions?
Hi
I need to identify if the operating system is Windows 2000 Server or
Professional.
I was hoping to use the OS version number but they are the same for both
systems.
Is there another way to do this without using the OS name to check if it
contains "Server" or "Professional"?
Regards
Wayne Tag: Folder access / User Tag: 189861
Locate a substring in a string
HI
Does VB5 have a function like Pascal's "POS" or "CHARINDEX" in SQL?
I need to find the index of a specific substring in a string.
cheers
Henry Tag: Folder access / User Tag: 189856
Dynamic variables?
What I like to use in VBS is what I used in Foxpro/Clipper a long time ago :
(see http://www.ghservices.com/gregh/clipper/trix0003.htm)
X := 10
Y := 'X'
? &Y.
Displays 10
Here is another example: 01 X := 10
02 Y := 'X + 1'
03 ? &Y. // Displays 11.
Here is the first step, substitution:
03 ? &'X + 1'.
The macro operator and period cancel the quotes:
03 ? --X + 1--
Which leaves this code:
03 ? X + 1
Is this in any way possible with VBS ?
Best regards,
Gert Tag: Folder access / User Tag: 189854
Differneces between GetObject and ConnectServer ?
I have a script that has been running well using GetObject srings (#1
below) to access registry info on remote servers. I have recently
changed this to a ConnectServer string (#2 below) to access servers
running in non-trusting domains and workgroups so I can pass
credentials. All other WMI requests are working but the GetString
function fails (#3 below). Is the ConnectServer function only good for
standard WMI collections and not accessing registry info or am I
missing something? Hopefully a second pair of eyes can see my mistake.
Thanks in advance for any input.
(#1)
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
(#2)
Set objReg = SWBemlocator.ConnectServer(strComputer, _
"\root\default:StdRegProv",strUserName,strPassword)
(#3)
objReg.GetStringValue HKEY_LOCAL_MACHINE,strSAVKeyPath,_
strSAVValueName,strAV
Dale Tag: Folder access / User Tag: 189848
Local Group Policy editing with VBscript
Hi all.
I would like to change one setting in Local GP. The thing is, when yo
remove PC from domain and reboot it, you can not connect to it remotel
anymore. There is one setting which, unfortunately, cannot be set wit
AD. Does anyone know, how to modify Local GP?
Thanks
-
mcmalla
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: Folder access / User Tag: 189847
Help to mak VBScript
Hi.
I trying to make a VBScrip that take 2 files (ABC.ful and ABC.log) in Server
A, Zip this two files in ABC.zip (maybe in WINZIP version 9), than move this
ABC.file to server B and at least delete from server A the original files
(ABC.ful and ABC.log).
The problem that i have is that ABC.ful have 8.5Gb.
Anybody have smoe idea to do that ?
Thanks.
Alexandre Fernandes Tag: Folder access / User Tag: 189845
File.Move "Permission Denied" Error
I have been struggling with this problem, and can't seem to find any
relief, so I appeal to you Visual Basic Scripting experts to alleviate
my burden. I'm writing a script that checks the contents of some ini
type files, and attempts to move them to a folder if they meet certain
requirements. Here is a snippet of the code:
Set FsoObject = WScript.CreateObject("Scripting.FileSystemObject")
If Not FsoObject.FolderExists("C:\Program
Files\FCS\WSO\Components\Backup\") Then
FsoObject.CreateFolder("C:\Program Files\FCS\WSO\Components\Backup\")
End If
Dim fil
Dim fil2
Set NetworkFolder = FsoObject.GetFolder("S:\Apps\WSO-RPTS")
Set LocalFolder = FsoObject.GetFolder("C:\Program
Files\FCS\WSO\Components")
Nothing too mind blowing so far, I presume. It all works peachy up to
this point, and for a bit more:
For Each Fil in NetworkFolder.Files
If fil.Type = "WSW File" Then
Set INIFile = FsoObject.OpenTextFile(fil)
strText = INIFile.ReadAll
ReportCategory = GetINIString("REPORT","CATEGORY", fil, strText)
ReportTitle = GetINIString("REPORT","TITLE", fil, strText)
For Each Fil2 in LocalFolder.Files
If fil2.Type = "WSW File" Then
Set INIFile = FsoObject.OpenTextFile(fil2)
strText = INIFile.ReadAll
ReportCategory2 = GetINIString("REPORT","CATEGORY", fil2,
strText)
ReportTitle2 = GetINIString("REPORT","TITLE", fil2, strText)
If ReportCategory2 = ReportCategory and ReportTitle2 =
ReportTitle Then
fsoObject.MoveFile fil2.path, fil2.ParentFolder & "\Backup\"
'fil2.Move "C:\Program Files\FCS\WSO\Components\Backup\"
End If
End If
Next
fil.Copy "C:\Program Files\FCS\WSO\Components\", True
End If
Next
The GetINIString Function is working great, it seems to be the problem
arises with this line from hell:
fsoObject.MoveFile fil2.path, fil2.ParentFolder & "\Backup\"
This was a replacement for:
fil2.Move "C:\Program Files\FCS\WSO\Components\Backup\"
Which replaced:
fil2.Copy "C:\Program Files\FCS\WSO\Components\Backup\"
fil2.Delete
Each of these lines gives me a "Permission Denied" error. The
fil2.Copy line appears to work, but the fil2.Delete gives me Permission
Denied. Every other post I read on this subject has people replying
with comments such as: "Make sure you have permissions." I do, as
evidenced by the fact that I can move these files manually to my
heart's content. However, I'm really only content doing that a few
times, before I find myself wishing that the darn script would work, so
my heart could find contentment elsewhere. Please, I implore you, help
me see the error of my ways. Thank you. Tag: Folder access / User Tag: 189839
Virtual Directories
Anyone know how to use VBscript to check for virtual directories like
iissamples and if they exist write to a text file? Tag: Folder access / User Tag: 189837
VBScript and HTTPS file download
I need to download a daily file from a remote site using HTTPS. Can this be
done with VBScript? If so, how and how do I pass the certificate, etc.?
Thanks Tag: Folder access / User Tag: 189826
XCACLS.vbs adding Power users
I need to add the power users group of the local pc to the secruity tab of
the local disk(c:)
I've got XCACLS.vbs in my Windows folder, but I need help in making a script
that will add the Power Users group to the secriuty tab of the local disk
with permissions set to
allow....
Modify
RD&Ex
List
Read
Write
any ideas or suggestions would be very helpful.
Thanks Tag: Folder access / User Tag: 189822
Brain Teaser for VBScript, VBA, HTML, and JavaScript Expert
Hello. Im using MS Access 2003. My goal is to use a form that will
check inventory with the click of a button. In order to check
inventory, a username and password is required to log onto a website.
I can handle making an IF statement based on a user's computer's
number/name to log in different people.
The problem is recreating a session id. Using Internet Controls and
VBScript I can mix VBScript and VBA into a module. The SENDKEYS method
can be used but within the HTML a session id is created. I have a
feeling that there is a cookie that contains a random generator. If it
is not a cookie then it might be a style sheet.
The code is simple, it looks a little something like this:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
=AD''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
'''=AD'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
''''''=AD'''''''
Dim ie As Object
Set ie =3D CreateObject("InternetExplorer.Application")
ie.Navigate ("https://fgv.ups-scs.com/fgv/admin_login.build_logon")
ie.Visible =3D True
Do Until ie.ReadyState =3D 4
Loop
AppActivate ("Internet Explorer")
SendKeys "USERNAME"
SendKeys "{TAB}" & "PASSWORD~"
SendKeys "%d" &
"https://fgvreports.ups-scs.com/reports/cgi-bin/upfcgi.exe~"
strPartNumber =3D Forms![PartnumberControl]
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}strPartNumber{ENTER}"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
=AD''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
'''=AD'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''=
''''''=AD'''''''
Anyone have a clue? I am a rookie with HTML VBDS and JavaScript.
Also,
what the hell is WSH? Any insight would be greatly appreciated.
THe website's Source Code:
<TD width=3D466><!-- BEGIN Center column modules --><!-- BEGIN WELCOME
MESSAGE --><SPAN class=3Dheader>Flex Global View</SPAN><!-- END
WELCOME MESSAGE --><P><BR><NOSCRIPT><SPAN class=3DredErrorBold>JavaScript
is disabled on your browser. This site is best viewed with
JavaScript enabled. Please turn it back on and reload this
page.<BR><BR></SPAN></NOSCRIPT><FORM ACTION=3D"/fgv/admin_login.action"
METHOD=3D"POST" NAME=3D"logOnForm"><INPUT TYPE=3D"hidden"
NAME=3D"p_session_id" VALUE=3D"614681169581"><INPUT TYPE=3D"hidden" Tag: Folder access / User Tag: 189816
How can I know my username in Windows Domain?
Hello all
I need create an script that contains:
Username, Accoutname, Workstation name
I tried but nothing appears...
Thanks in advanced.
h. Tag: Folder access / User Tag: 189814
threads in vbs
Is it possible to run a subprocedure as a thread
using vb script? Can someone help with this issue.
Thanks
ccs-tech Tag: Folder access / User Tag: 189813
Event Viewer Settings
I'm writing a script to configure workstations after I load XP. I'd
rather do this than use ghost because I have so many different types of
systems.
I'm trying to write a portion that will adjust the event viewer
settings, but I don't know if those settings are stored anywhere.
This is what I'd like to change.
Right click on "Application", click on "Properties"
Set "maximum log size" as 1024 kb and select "overwrite as
needed"
Is this possible without using the GUI? Tag: Folder access / User Tag: 189811
Priority Queues in VBScript
Hello,
i am trying to make a priority queue in VBScript. I want to use an
array and some function for that.
I have it defined in VBA like that:
--->VBA Code
Type Item
Name As String
Priority As Integer
End Type
Dim Queue(100) As Item
function AddToQueue() As Boolean
function DeleteFromQueue() As Boolean
<---VBA Code
I want to use it in the MUSHClient. It is a telnet-Client for MUD
games.
I wonder how I could do the same definitions in VBScript because I read
that I cannot use data types. Do I have to declare two arrays? e.g.
Priorities(100) and Names(100)
Thank you,
Thomas Tag: Folder access / User Tag: 189810
Elimiated statusbar, toolbar and menubar
I just have one index.html page with NO links NO pics. Just a simple
html page.
Whenever I open that page I want to eliminate few things like:
I don't want scroll bar -> I have a solution <body scroll="no">
I don't want status bar -> ? need solution ?
I don't want toolbar bar -> ? need solution ?
I don't want menu bar -> ? need solution ?
I JUST want the title bar, address bar and the IE window.
Please help Tag: Folder access / User Tag: 189808
Hi,
Does anyone know a script that gives all the folders where a user has
access too.