Removeing a local account from the Power Users group
How would I remove an account from the Power Users group with a vbs script?
And then create a local account and set a password then
add the new account to the Power Users group.
I need to be able to do this on 300+ systems.
Thanks. Tag: Scripting firewall rule change Tag: 153849
Help with time
Hi, I need to know how I can use time as a variable in cleaning out a folder
of old files. Specifically, I need to delete log files older than 6 hours.
Any ideas?
Thanks in advance for any assistance,
Mike Deering Tag: Scripting firewall rule change Tag: 153841
mailto with multiple text box
Hi all,
I want to use the following form:
<form name="Myform" method="post" action="">
<p>
<input name="name" type="text" id="name">
Name </p>
<p> <input name="email" type="text" id="email">
Email </p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
to send an email? I can use JavaScript, VBScript or Mailto, but I can't use
server
side scripting. Is very important for me that form use MULTIPLE text field.
Thanks in advance Tag: Scripting firewall rule change Tag: 153840
createobject fails??
Hi,
I have a problem that an ActiveX exe class library that I created in VB6
will work properly when 'createobject' is used within VBA or VB, but fails
when used from VBScript (e.g. - run from WSH or an application using the
Microsoft scripting engine). I *think* this may be a permissions problem but
have not been able to find a clear description of how one sets activex
permissions.
In the script, I'm getting error 424 "object required".
Strangely, another activex exe that I had written previously works fine,
even though I can see no difference in the way I set up the project...!!
Any suggestions?
--
Regards,
Steve O'Hagan Tag: Scripting firewall rule change Tag: 153839
Can I do client side populations from my ASP Page?
I have done alot of ASP pages with VBScript which is all server side. I
have done a few VBS files that runs locally and works with web forms. I
would like to have a ASP webpage with a form for the user to enter data.
I would like to include some client side stuff such as:
When the user keys in the first value in a row the value is copied to
the other fields in the row. And when a user clicks on certain values
in an option box it would enable/disable or visible/hide additional
fields. And finally make sure all visible fields are populated before
the data is set back to the server.
Any good examples of how to do this?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Scripting firewall rule change Tag: 153837
Create exchange mailbox
Hi there,
I have my script done to create everything for the user apart from the exchange 2k mailbox. Anyone got some code to do this. Some comments on what to change within the code would be appreciated.
Thanks,
Senore Pedro Tag: Scripting firewall rule change Tag: 153836
Limitation on fso size function
I've written a script to get the sizes of the various data shares on our
servers. The relevant part of the code is like so:
computerName = WSHShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
f = "\\"&computerName&"\home"
dirsize = objFSO.GetFolder(f).Size
strf = f & " " & dirsize & " bytes"
outFile.WriteLine strf
And the same for the other shares we use. When I run this on each
server, it works fine except on some of the large servers, where the
shares are quite large (> 200Gb, some getting up to half a terabyte). On
these servers, the dirsize variable comes back empty from the call to
Size, but as it doesn't return immediately but runs for some
considerable time before failing, it would seem to be failing somewhere
inside the recursion through the directory structure.
I guess the two possibilities are either that the function can't cope
with a dir structure over a certain size or with an overly long
pathlength somewhere in the directory structure. The largest dir for
which I have got a valid result back from Size is 207442015120 bytes. As
this is actually slightly larger than some of the shares for which the
function fails (I got the size of those shares from the right-click dir
properties in Windows Explorer), I suspect that the problem is with
pathlengths > 256 chars long.
Any suggestions on how to get a script to return the size of these dir
structures? I'm running the script on Win2000 SP4 servers.
Nick Tag: Scripting firewall rule change Tag: 153832
Getting active user name
How can I get (using VBScript in Outlook Form) user name, that is currently logged in? Tag: Scripting firewall rule change Tag: 153830
Remote Assistance.
Does anyone know how to 'Offer Remote Assistance' to a remote computer with
VbScript with the Ip or NetBios name?
Remote Desktop was much easier using the following but I haven't been able
to figure this one out.
SET SHELL = CREATEOBJECT("WSCRIPT.SHELL")
SHELL.RUN("MSTSC /V:" & REMOTE_COMPUTER & " /CONSOLE")
Much appreciated.
Rob Tag: Scripting firewall rule change Tag: 153826
read and compare 2 file dates/times
Guys
I have a issue with comparing the Time and date stamp of a file in FTP
folder on the web and the same file previuosly down loaded.
I have written a script where it goes to the FTP site and get the file
details like date and time stamp and these info are recorded in
FTP1.TXT file looks like
---------------------FTP1.TXT----------------------
-rwxrwxr-x 1 hevasymantec-ftp5 hevasymantec-ftp3 4651576 Feb 11
14:15 symcdefsi32.exe
---------------------------------------------------
I run one more script which gets the file deatils of prevoiusly
downloaded file which is ther on G:\
------------------Ter.txt-------------------------
Volume in drive G is Local Disk
Volume Serial Number is 8C0A-2423
Directory of G:\
20/02/04 16:03 4651598 symcdefsi32.exe
1 File(s) 4651598 bytes
4,600,000,512 bytes free
-------------------------------------------------
Now how do I compare the dates to find out which is new...BTW there is
no version property for this file
Thanks
cha Tag: Scripting firewall rule change Tag: 153824
Why does the & result in the error message???
Hello
I am just trying to learn VBscript. I get an error message I can't solve. This code is in a wsf file.
<?xml version="1.0"?><package><job id="VBSJob"><?job debug="true" error="false"?><script language="VBScript"
Dim fs, strMsg
strMsg2 = "text1 " & "text2
MsgBox strMsg
</script></job></package
The error message I receive is:
test.wsf(15, 12) Windows Script Host: Unterminated entity reference - matching ';' not foun
The script runs fine without the & operation
Can someone tell me what I do wrong
I use WSH 5.6 on Windows 2000 Pro. Tag: Scripting firewall rule change Tag: 153811
Help - cannot copy file to remote desktop
Hello,
I'm want to copy a file to many pc's, either to the desktop or Startup
folder. OS is 2k. Local admin password is the same on all, all pc's in the
same workgroup.
With the script below, I can open the desired folders and manually copy with
no problem.
I can also copy to the root folder. Something else I tried without success
was to copy to C: and create shortcut on remote desktop. I know I can do
this from a local script, but not remotely. Error messages included in
script.
Thanks
Set oFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
'Open a text file of computer names
Set oTS = oFS.OpenTextFile("F:\getlist\blacat.txt")
Do Until oTS.AtEndOfStream
sComputer = oTS.ReadLine
DesktopPath = WshShell.SpecialFolders("AllUsersDesktop")
WshShell.Run "\\" & sComputer & "\d$\Docume~1\Alluse~1\Desktop"
'This works
WshShell.Run "\\" & sComputer &
"\d$\Docume~1\Alluse~1\StartM~1\Programs\Startup" 'This works
oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer & "\c$\"
'This works
Wscript.echo "\\" & sComputer &"\" & DesktopPath
'This works and looks ok
'WshShell.Run "\\" & sComputer &"\" & DesktopPath
'This don't work
'Error Message - The system cannot find the path specified.
'oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer &
"\d$\Docume~1\Alluse~1\Desktop" 'This don't work
' Error Message Permission denied.
oFS.CopyFile "C:\scripts\getlist\blacat.txt" ,"\\" & sComputer & "\" &
DesktopPath This don't work
'Error Message path not found
Loop
oTS.Close Tag: Scripting firewall rule change Tag: 153810
caption compare
Is there any function or add-in in visual basic that allows you to compare
the caption of two text boxes and output a percentage of how similar they
are? If not is there an easy way of doing this? Many thanks in advance. Tag: Scripting firewall rule change Tag: 153806
How to prevent calculated variables from rounding?
I'm trying to get the output of the variable "ResTime" to come out in
a format like 2.45
Instead, the following code rounds the number like 2.00
<%
StartDate = rs.fields.item("Date_Created").value
EndDate = rs.fields.item("Date_Closed").value
ResTime = FormatNumber(Cdbl(DateDiff("h",StartDate,EndDate)),2)
%>
I am able to get the desired result (no rounding) by using...
Convert(decimal(10,2), (datediff(hour, [date_Created], [date_closed]))
...directly in a SQL query. But the way my ASP page works, I really
want to be able to manipulate and calculate the variables in VBScript
after the query is run.
Any suggestions? Thanks,
Russell Tag: Scripting firewall rule change Tag: 153804
Can't get debugger to work.
I run my vbs script using the following command line and get a box that
tells me there is a syntax error. Then another box pops up and asks me to
select a debugger, but the list is empty
I installed the microsoft script debugger, but its dated 1997 and let me run
vbs files, just open them. Thanks in advance.
Mas
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- Tag: Scripting firewall rule change Tag: 153801
Problem accessing exe and url attachments using cdo!
Hi all,
I'm writing a script that will create a list of attachments in an
exchange 5.5 mailbox folder.
The code below works except it can't find .exe or .url attachments.
If I rename the same attachment's extensions ( .ex ,.e ,.ur,
.u,.test,.etc) they are reported.
I'm using cdo 1.2 (not sure how to determ the version my vbs script is
really using)
I'm developing and testing on
Windows XP PRO w/ Office XP PRO installed
against an Exchange 5.5 sp4 server on an NT4 sp6a machine
Could this be Office XP security settings blocking .exe and .url?
Or the OS or CDO 1.2 security?
I run the script using wscript.exe.
Thanks,
Doug
below is the subroutine responsible for finding and reporting
attachments in a folder.
sub scanAttachments( objFolder)
' get Inbox's messages collection
Set objMsgColl = objFolder.Messages
' performs loop, Sets each objMess
For Each objMess in objMsgColl
set objAttachments = objMess.Attachments
For Each objAttachment In objAttachments
' report each attachment to a file
strAttName = objAttachment.Name
objFile.WriteLine = objFolder.name & "," & strAttName
Next
Next
end sub Tag: Scripting firewall rule change Tag: 153800
date string like 2004-02-26-17-07
How to easily make a string that contains the current YYYY-MM-DD-HH-MM like
on
Unix:
date +'%Y-%m-%d-%H-%M'
2004-02-26-17-07
Is there an easier way than using Year, Month, Hour etc then testing each
for nos <10 and inserting 0 if so?
thanks in advance
John Tag: Scripting firewall rule change Tag: 153799
Help with VBS and ASP
I have a script sitting in my asp page, and I needs some help trying
to accomplish something. Below is my script and I can display the
date in my title of my web page, but I would like to display the
pervious date if possible. I am pulling information out of a database
for things that happened the day before and want to print that date
out.
%>
<html>
<head>
<title>Eventlogs for <% Response.Write Date() %></Title>
</head>
<body>
<p>
<%
Thanks for the help in advanced,
Steve Tag: Scripting firewall rule change Tag: 153793
Help with ASP and HTML Tables
Below is my code, I am one trying to make it where I don't have my
usename and password, and server information to be in my code.
Second, unser my response.write, I want to massage this data into
table format where it will make sense. All I get now is everthing ran
together. If you can, can some help me in doing this.
Thanks in advance.
Stephen Robinson
______________________________________________________________________
<%@ Language=VBScript%>
<%
dim Conn, objRS, objConn, strSQL
Set Conn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")
Conn.Open = "provider=sqloledb;data source=SCK-EAV-01;" & _
"user id=sa;password=XXXXXX;" & _
"initial catalog=Eventlogs"
strSQL = "SELECT [ComputerName], [EventCode], [Message] " & _
"[SourceName], [TimeWritten], [Type] FROM [EventTable] " & _
"WHERE [Type]='error' ORDER BY [TimeWritten]"
objRS.Open strSQL, Conn, 0, 1 'adOpenForwardOnly, adLockReadOnly
%>
<html>
<head>
<title>Eventlogs for <% Response.Write Date() %></Title>
</head>
<body>
<p>
<%
objRS.MoveFirst
While Not objRS.EOF
Response.Write objRS("ComputerName") & objRS("EventCode") &
objRS("SourceName")
objRS.MoveNext
Wend
%>
</p>
</body>
</html>
___________________________________________________________________________ Tag: Scripting firewall rule change Tag: 153792
Toggle IE Accessibility settings
Here's a VBS for quickly toggling "Internet options", "Accessibility",
to use/ignore web page fonts and colors. I've named the file "IE
Accessibility.vbs" and placed it in
. . .\Documents and Settings\. . .\Favorites\Links
To toggle the settings, just click on the "IE Accessibility.vbs"
button in the IE "Links" toolbar. Your comments and ideas are most
welcome. I'm pasting the code below, sorry about the wrapped lines:
============== START ===================
'Toggle IE Accessibility settings
Set WSHShell = CreateObject("Wscript.Shell")
RegKey = "HKCU\Software\Microsoft\Internet Explorer\Settings\"
With WSHShell
If .RegRead(RegKey & "Always Use My Colors") = 1 Then 'Use Web
page Fonts and Colors
.RegWrite RegKey & "Always Use My Colors", 0, "REG_DWORD"
.RegWrite RegKey & "Always Use My Font Size", 0,
"REG_DWORD"
.RegWrite RegKey & "Always Use My Font Face", 0,
"REG_DWORD"
Else 'Ignore Web
page Fonts and Colors
.RegWrite RegKey & "Always Use My Colors", 1, "REG_DWORD"
.RegWrite RegKey & "Always Use My Font Size", 1,
"REG_DWORD"
.RegWrite RegKey & "Always Use My Font Face", 1,
"REG_DWORD"
End If
End With
WSHShell.Run "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl", 1,
False
If ActivateWindow("Internet Properties") Then
WSHShell.SendKeys "{ENTER}", True
End If
WScript.Quit
Function ActivateWindow(Title)
Do
i = i + 1
If i > 50 Then Exit Do 'Try for max 5 seconds
WScript.Sleep 100
ActivateWindow = WSHShell.AppActivate(Title)
Loop While ActivateWindow = False
' WSHShell.Popup i ' Debug attempt count
End Function
============== END =================== Tag: Scripting firewall rule change Tag: 153785
VBScript runtime (0x800A0046) Permission denied: 'GetObject'
Hello,
I am trying to construct a script that will add local users to a remote
machine that does not reside in the same domain as the machine running the
script. Currently I have the following;
'---------Script Begin--------------
strComputer = "Reports"
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = colAccounts.Create("user", "NewUser")
objUser.SetPassword "1234"
objUser.Put "Description", "NewUser account"
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/NewUser,user")
objGroup.Add(objUser.ADsPath)
objUser.SetInfo
'---------Script End--------------
The problem here is that the computer "Reports" is not the computer
running the script nor is it even in the same domain. When I run it now I
get
Error: Permission denied: 'GetObject'
Code: 800A0046
Is there a way I can pass a username and password or something so it
will work?
--
-Scott Elgram Tag: Scripting firewall rule change Tag: 153784
problems with a scheduled script
I have a small script that gives me some problems.
The script is
InFolder = "\\10.1.1.3\mcafee$\Autoupdate"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fld = FSO.GetFolder(InFolder)
When i run the script via the command line it runs without a problem.
When i schedule the script i get the following message when it runs
Line : 3
Char: 1
error : Path not found
code : 800A004C
Who can help ?
Rikkie Tag: Scripting firewall rule change Tag: 153781
How to register a NT client on a 2000 Dynamic DNS via script
Hi, all
is there a way to register a nt machine with a script o similar on a DNS
server on Windows 2000 with dynamic update activate?
Thanks, Giuseppe Cibrario Tag: Scripting firewall rule change Tag: 153780
Differentiate between Server and Workstation
Hello,
I need to run a script in a W2K AD domain but I only want it to run against
servers (Member, DC, GC, FSMO).
Is there a way to do this using VBScript (only - no third party apps)?
All suggestions will be greatly appreciated.
TIA,
Bill Burke
bill@2burkes.com Tag: Scripting firewall rule change Tag: 153778
Last time Password Changed
I want to write a script that will query AD and tell me when a user last
changed thier passsword or how old the password is. Any ideas? Tag: Scripting firewall rule change Tag: 153775
ARITHABORT when trying to run UPDATE query from vbscript?
Hi All,
I have a simple update query that I'm trying to run in VBScript
against an SQL SERVER 2000 database table.
The query runs without problems when I run it in SQL Analyzer,
however, when I try to run the same query in VBScript, I get the
following error message:
Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL
Server Driver][SQL Server]UPDATE failed because the following SET
options have incorrect settings: 'ARITHABORT'.
I think the problem is caused because I have an indexed computed
column in this table that concatenates several other columns from the
table, and the update query is updating a column that included in the
computed column's concatenation.
However, I'm confused that this would run in SQL Analyzer, and not in
VBScript. I was expecting that it would either run in both, or
neither.
Can anyone give me any advice on how to get past this error?
Much warmth,
Murray Tag: Scripting firewall rule change Tag: 153774
cration of Mailenabled user
Hi,
I would like to create a mailenabled user in AD, not a mailboxenabled user.
When I put an external e-mailaddress in TargetAddress i only get an account
that is disabled in AD. Is there any other attributes that needs to be
established?
//Mariah Tag: Scripting firewall rule change Tag: 153773
Scripting the display of active desktop items?
It's driving me nuts
I have a gif[1] that comes from the web and is on my desktop as active
content.
Sometimes I want it displayed, sometimes I don't.
Switching it off is easy - just click the little x at top rhs.
Switching on? right click on the desktop, properties/desktop/customise
desktop/web/checkboxes
Anyone know how I can script that (and I don't mean sendkeys :-))?
I know how to script changes to the registry, but not yet the values for the
relevant entries which I suspect are
HKCU/software/internet explorer/desktop/components...
Anyone know for certain what the various entries there mean and valid
values? and that they are the ones that matter?
I would prefer something less brutal than registry editing IYSWIM.
Many thanks in advance.
[1]http://www.meto.gov.uk/datafiles/flat3ani.gif
William Hite
maximize the value of your IE favs: www.searchfavorites.com Tag: Scripting firewall rule change Tag: 153767
Enumeration of Files on the Local Machine
Hi,
Does anyone know how I can enumerate files on the local computer in a
directory?
I need to do 2 things in my script. Get a list of all the files in a
particular directory into an array from the local machine
and in a second array, get a list of files on a shared directory on a remote
computer
Any ideas? Tag: Scripting firewall rule change Tag: 153765
Serial communications
Hello,
Is it possible to send data on the serial port via vbscript?
Gr
Yves Wittouck Tag: Scripting firewall rule change Tag: 153764
WSH - VBScript - Retrieving 'Last Saved By' for Office Doc (2K)
Hi,
I am trying to use a VBScript WHS script to retrieve the Last Saved By
property for an Excel 2000 document.
Can somebody please clue me in?? I'd be very thankful.
Thanks,
FM Tag: Scripting firewall rule change Tag: 153757
entering system variables over a network
A new software package we are implementing needs a path, (eg c:/temp) to
be placed in the "variable value" field via control panel, system,
advanced, environmental variables, then by clicking on path, edit in
the system variables box.
The path needs to be placed on all the computers in our domain.
Can this be done with VBS scripts or with active directory. Any ideas
would be valuable. If to be done with VBS the code would be great.
Thanks,
Tim, (Adelaide Australia).
--
hekyl
------------------------------------------------------------------------
posted via www.WebFrustration.com Tag: Scripting firewall rule change Tag: 153755
*** Help Req: problems with a vbscript used in an SMTP eventsink
Win2K3 server, running the default Microsoft SMTP service. The server
is forwarding mail to an internal email server.
I installed spamassassin using the instructions from here:
http://www.openhandhome.com/howtosa260.html
All my spamassassin tests are 100% successful. I then downloaded a
recommended vbscript to integrate spamassassin with the SMTP service,
via something called an eventsink.
When I enable the spamfilter.vbs eventsink, email still flows just
fine. However, spamassassin never runs.
Can anyone assist me in getting the code below to actually run on
every email?
<SCRIPT LANGUAGE="VBSCRIPT">
On Error Resume Next
' Declare Windows 2000/2003 SMTP Transport Event Sink constants
Const cdoRunNextSink = 0
Const cdoSkipRemainingSinks = 1
Const cdoStatAbortDelivery = 2
Const cdoStatBadMail = 3
' Declare ADO constants
Const adSaveCreateOverWrite = 2
' paths to folders we will be using
Const TEST_PATH = "c:\TEST\"
Const SPAM_PATH = "c:\test\spam_final\"
Const NONSPAM_PATH = "c:\test\NONSPAM_FINAL\"
Sub ISMTPOnArrival_OnArrival(ByVal objMessage, EventStatus)
'Start up Error Checking (so that we can promptly ignore it)
On Error Resume Next
' Declare variables
Dim strTestEmail
Dim objFields
Dim objStream
Dim iCount
Dim listRnd
Dim iRnd
Dim strRandom
Dim oShell
Dim objFileSystem
Dim strMessage
Dim ts
Dim f
' Get fields collection of message
Set objFields = objMessage.EnvelopeFields
' Process message
With objMessage
' Get message as stream
Set objStream = .GetStream
' Save message as stream to file
objStream.SaveToFile (TEST_PATH & "spamtestin.txt"),
adSaveCreateOverWrite
End With
'spamtest file now exists, so we should now run spamassassin
against it and have it output a file
Set oShell = wscript.CreateObject("WScript.Shell")
comm = "e:\perl\bin\spamassassin.bat < c:\TEST\spamtestin.txt >
c:\TEST\spamtestout.txt"
oShell.Run comm
'now open up the spamtestout.txt file and see if that is spam (see
if it contains "X-Spam-Status: Yes"
'if it is spam, then copy spamtestin.txt to a randomly named text
file in the SPAM_PATH
'if it is not spam, then copy spamtestin.txt to a randomly named
text file in the NONSPAM_PATH
'then later run bat scripts to learn on those directories, and
then del the files in there after learning
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
'open up the file
Set f = objFileSystem.GetFile(TEST_PATH & "spamtestout.txt")
Set ts = f.OpenAsTextStream(1,-2)
strMessage = ts.ReadAll
ts.Close
If InStr(1, strMessage, "X-Spam-Status: Yes", 1) Then
'if in here, then we will add a flag to the message
subject
objMessage.Subject = "*****SPAM*****" & objMessage.Subject
objMessage.DataSource.Save
'the message is still getting sent to the user, so keep
checking sinks
EventStatus = cdoRunNextSink
End If
' Clean up the mess we have made
Set objFileSystem = Nothing
Set objStream = Nothing
Set objFields = Nothing
Set oShell = Nothing
Set f = Nothing
Set ts = Nothing
End Sub
</SCRIPT> Tag: Scripting firewall rule change Tag: 153746
Read first few characters in Variable
I have written a script that reads CSV file lines into an variable.
I then split the variable into other variable where the comma is the
delimiter.
What I can't figure out is how to read only the first 3 characters of the
third variable.
Here is some code:
Possible lines from CVS file:
Internet,Google,http://www.google.com
Office,Microsoft Word,%PROGRAMFILES%Microsoft Office\Office10\winword.exe
Note, not all the code for reading the file is here.
I want to be able to read the first 3 characters of the variable "scTarget".
I need to be able to seperate the URLs from regular file locations to create
the proper shortcut type.
Code lines:
strOTF = fName.ReadLine() 'Read the next line in the CSV file
strARR = Split(strOTF,",") 'Split by the , (comma)
scFolder = strARR(0) 'Folder name
scName = strARR(1) 'Shortcut name
scTarget = strARR(2) 'Target of shortcut
Thanks for any help.
Dan Tag: Scripting firewall rule change Tag: 153742
get ProxyAddresses from any user in AD
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C3FBC3.ABE7B730
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm trying to get the ProxyAddresses from any user in AD. However, I can =
get around the requirement in LDAP for the OU. If I omit OU then I get =
an error. However, I can retreive the User Object if I included the OU =
for a known user in a known OU. The point is that I don't know what OU a =
user is in but I need to retrieve ProxyAddresses from all User objects. =
Am I going about this wrong or is there a better way?=20
strUsername =3D "tuser"
set objUser =3D GetObject("WinNT://domain/" & strUserName & ",User")
Set objUserLDAP =3D GetObject( "LDAP://CN=3D" & objUser.fullName & =
";OU=3DIT;DC=3Ddomain,DC=3Dcom" )
For Each strAddr in objUserLDAP.ProxyAddresses
strList =3D strList & strAddr & vbCrLf
Next
wscript.echo strList=20
Thanks,
m@n.com
------=_NextPart_000_0009_01C3FBC3.ABE7B730
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I'm trying to get the ProxyAddresses =
from any user=20
in AD. However, I can get around the requirement in LDAP for the OU. If =
I omit=20
OU then I get an error. However, I can retreive the User Object if I =
included=20
the OU for a known user in a known OU. The point is that I don't =
know what=20
OU a user is in but I need to retrieve ProxyAddresses from all User=20
objects. </FONT><FONT face=3DArial size=3D2>Am I going about this =
wrong or is=20
there a better way? </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>strUsername =3D =
"tuser"</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>set objUser =3D=20
GetObject("WinNT://<EM>domain</EM>/" & strUserName &=20
",User")</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Set objUserLDAP =3D GetObject( =
"</FONT><A=20
href=3D"ldap://CN"><FONT face=3D"Courier New" =
size=3D2>LDAP://CN</FONT></A><FONT=20
face=3D"Courier New" size=3D2>=3D" & objUser.fullName &=20
";OU=3DIT;DC=3D<EM>domain</EM>,DC=3Dcom" )</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>For Each strAddr in=20
objUserLDAP.ProxyAddresses<BR> strList =3D strList =
& strAddr=20
& vbCrLf<BR>Next<BR></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>wscript.echo strList =
</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT =
face=3DArial></FONT></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT=20
face=3DArial>Thanks,</FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT face=3DArial><A=20
href=3D"mailto:m@n.com">m@n.com</A></FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New" =
size=3D2> </DIV></FONT></BODY></HTML>
------=_NextPart_000_0009_01C3FBC3.ABE7B730-- Tag: Scripting firewall rule change Tag: 153741
Login script question
I was curious if there is a way that I can some how create a login script
that will map drives acording to the local server?
We are a bank that has what we call floaters. Theses are employees that
may work in Branch A today and then Branch B the next day. I would like to
be able to create a login script that will map out the drives that this
user needs according to the branch they are at today. All of the branches
are the same as far as a directory structure is concerned.
For example:
Today at Branch A they login into a local computer and the login script
maps the F: drive to \\Br-A\Data.
The next day while at Branch B they login to a local computer and the login
script maps the F: drive to \\Br-B\Data.
I posted this in another group and they suggested I post it here. I this
is the wrong place, please re-direct me.
I also have no experience in scripting, we are migrating from Novell to MS,
and I was curious if there are any good references for this?
Thanks. Tag: Scripting firewall rule change Tag: 153740
Change Primary Monitor
I am having a problem where I need to change what display (I have two) is set
as primary when certain programs are executed, and reset it when they close.
Is there a way to do this with VBS/WSH, or some simple program I could write
in VB.NET? I know there must be a way; but I am still a beginner and haven't
found it. Any help would be aprreciated.
--
Thomas E Lackey Tag: Scripting firewall rule change Tag: 153732
convert bat to vbs
Anyone have any idea how I can convert this bat file to vbs.
Thanks
Gavin...
@echo off
if exist "c:\program files\BigFix Enterprise\Bes Client\BESClient.exe" goto
AgentFound
@echo Now installing BigFix Enterprise Client on this machine ...
\\10.0.0.19\CLIENT\Setup /s /f2"C:\besinstall.log"
goto Exit
:AgentFound
echo Agent is already installed
:Exit Tag: Scripting firewall rule change Tag: 153730
Reading a CSV file with commas in the address field.
Hi
I thought I found what I was looking for with the split function, but then realized my data was not coming up correctly because there are commas in the address line. How, or what else can I use in order to correctly read my csv file. My csv file looks something like this
"John","Doe","223 Smith Street Washington, DC"
As you can see the split was splitting the address up between Washington and DC
Can someone point me in the right direction
Thanks Tag: Scripting firewall rule change Tag: 153727
xml.transformNode help needed
How do I apply a second transform to some XML? I want to run
"remove_name.xsl" followed by "consolidate.xsl".
thanks
LJB
---------------- This is my current vbs -------------------
Set xml = CreateObject("Msxml2.DOMDocument.4.0")
Set xsl = CreateObject("Msxml2.DOMDocument.4.0")
xml.async = False
xsl.async = false
xml.Load "SampleData.xml"
xsl.Load "remove_name.xsl"
?????? xml.transformNode( xsl)
xsl.Load "Consolidate.xsl"
wscript.echo xml.transformNode( xsl) Tag: Scripting firewall rule change Tag: 153722
Property Set with more than one argument
I'm having a problem with VBScript declaring a Property Set with more than
one arguments.
-----
'works fine:
Property Set prop (v)
'...
End
Set prop = object
-----
'also works
Property Let prop (k, v)
'...
End
prop("something") = "value"
-----
'will give me an error!
Property Set prop (k, v)
'...
End
Set prop("something") = object
-----
Here is my sample code:
---------8<--------
Class Object
Public key
End Class
Class Test
Private key
Public Property Get blub()
If IsObject(key) Then
Set blub = key
Else
blub = key
End If
End Property
Public Property Let blub( v )
key = v
End Property
Public Property Set blub( v )
Set key = v
End Property
Public Property Get blah( k )
If IsObject(key) Then
Set blah = key
Else
blah = key
End If
End Property
Public Property Let blah( k, v )
key = v
End Property
Public Property Set blah( k, v )
Set key = v
End Property
Sub tst(o)
'works:
blub = "val"
Set blub = o
'also works
blah(0) = "val"
'doesn't work
Set blah(0) = o
End Sub
End Class
Dim o, t
Set o = New Object
o.key = "k"
Set t = New Test
t.tst o
--------->8--------
Any ideas why a Property Set with more than one argument doesn't work?
What am I doing wrong?
Regards!
-Thomas Tag: Scripting firewall rule change Tag: 153717
COM add-in for Outlook
Hi,
I am building a COM add-in for Outlook to check the subject and body of
e-mails as they arrive for certain values.
I am currently using another COM add-in to navigate users to "Outlook Today"
when they launch Outlook. The code looks like the following:
***************************
Dim objOL As Outlook.Application
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
If Not Application Is Nothing Then
Set objOL = Application
Dim objFolder As Outlook.MAPIFolder
Set objFolder = objOL.Session.GetDefaultFolder(olFolderInbox).Parent
If Not objFolder Is Nothing Then
If objOL.Explorers.Count > 0 Then
Set objOL.ActiveExplorer.CurrentFolder = objFolder
End If
End If
Set objOL = Nothing
End If
End Sub
**************************
the code executes when users launch outlook. I need to have a method called
when users send and receive e-mails.
Please advise.
Rafael Tag: Scripting firewall rule change Tag: 153711
Non Greedy Regular Expression in Scripting Engine 5.1
Hi. I really need help with a regular expression in ASP. I need a regex
pattern that will grab a select or textarea tag in an HTML file. If I run
the pattern I should get
<select name="whatever">
<option value="a" selected>A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
Or
<textarea name="whatever">Here is some text area text</textarea>
I know the following pattern works:
<(select|textarea).*(.|\n)*?</(select|textarea)>
But the problem is my web hosting company is using ASP scripting engine 5.1
which does not support the non greedy delimiter (?). I doubt they are going
to upgrade to 5.5 anytime soon. I'll appreciate it if anyone can give me a
pattern that does the same job but does not use the ? delimiter. Is there a
way I can tweak the pattern above so that it works in ASP scripting engine
5.1? Thanks in advance. Tag: Scripting firewall rule change Tag: 153709
Imperial to metric conversion
Hi
I have a requirement to convert imperial length measurements to metric from
data entered into a form. Can anyone point me to somewhere with the details
on how to a achieve this?
Thanks
Chris Tag: Scripting firewall rule change Tag: 153708
replacing a character in very line of txt file
Hi,
I have a txt file with 12,000 lines.
I need to write a script which will replace the 21th charcater of everyline
with a "," character.
Anybody has a sample script to do somethins similar?
Thanks in advance,
Barak Tag: Scripting firewall rule change Tag: 153705
code puzzle (help please)
The following code bombs after the Name pop-up box. Without the parrens
around "Name" it bombs before that line. If I change oMyObj.get ("Class")
to oMyObj.Class it works fine, of course.
When I say "bomb" I mean that debugger opens with no code and rebooting
doesn't help.
Appreciate any ideas/help
J
<code follows>
Set oMyObj = GetObject("LDAP://ou=WST,dc=NWTRADERS,dc=MSFT")
WScript.Echo "Name is " & oMyObj.Get("Name")
WScript.Echo "Class is " & oMyObj.get ("Class")
WScript.Echo "GUID is " & oMyObj.get ("GUID")
WScript.Echo "ADsPath is " & oMyObj.get ("ADsPath")
WScript.Echo "Parent is " & oMyObj.get ("Parent") WScript.Echo "Schema is "
_
& oMyObj.get ("Schema") Tag: Scripting firewall rule change Tag: 153704
migration script
Hi
There're asp and VB aplications need to be migrated to
2003 server, what's the language to write migration
scripts, which level of scripting will be the best(such as
base on ADSI?), is there any resources
thank Tag: Scripting firewall rule change Tag: 153701
Disjoin a Domain and join a workgroup
Hi
Is there a way to disjoin a domain and join a workgroup instead? Is it possible with the JoinDomainOrWorkgroup Method in the Win32_ComputerSystem Class? Tag: Scripting firewall rule change Tag: 153700
Excel object broken in my scripts
This script was working good, until my win2k box had a profile problem.
When I logged in, I ended up with a default profile, instead of my own.
After rebooting, my old profile resumed working again, but my scripts were
broke. I have added and removed excel rebooting between removing and
installing, and after installing. To no avail, excel is no longer working
in my script. Any help would be greatly appreciated.
<<<<<<<Begin script
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
RootPath = "P:"
ResultLimit = 600
CompressLimit = 200
Const NOTIFY_ADMIN_SUCCESS = False
Const NOTIFY_ADMIN_FAILURE = True
Const NOTIFY_ON_COMPLETION = True
Const SUMMARY_OF_WORK = True
On Error Resume Next
'Set up the Excel Object
Set objExcel = WScript.CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
'>>>Set up the failure worksheet
RenameWorksheet "Sheet1", "Failure"
WriteCellLoc "A1", "Count", "True"
WriteCellLoc "A2", "Folder", "True"
WriteCellLoc "C1", "=COUNTA(A3:A900)", "False"
WriteCellLoc "B2", "Size", "True"
WriteCellLoc "B1", "=SUM(B3:B900)", "False"
FormatRange "B:B", "", "10"
FormatRange "A:A", "", "60"
FormatRange "B1", "#,##0""mb""", ""
FormatRange "B3:B900", "#,##0""mb""", ""
GotoCell "A3"
'>>>Set up the Success worksheet
RenameWorksheet "Sheet2", "Success"
WriteCellLoc "A1", "Count", "True"
WriteCellLoc "A2", "Folder", "True"
WriteCellLoc "C1", "=COUNTA(A3:A900)", "False"
WriteCellLoc "B2", "Size", "True"
WriteCellLoc "B1", "=SUM(B3:B900)", "False"
FormatRange "B:B", "", "10"
FormatRange "A:A", "", "60"
FormatRange "B1", "#,##0""mb""", ""
FormatRange "B3:B900", "#,##0""mb""", ""
GotoCell "A3"
If SUMMARY_OF_WORK Then
'Set up Summary Worksheet
RenameWorksheet "Sheet3", "Summary"
WriteCellLoc "A1", "Success", "True"
WriteCellLoc "A2", "Failure", "True"
WriteCellLoc "A3", "Total", "True"
WriteCellLoc "B1", "=Success!C1+0", "False"
WriteCellLoc "B2", "=Failure!C1+0", "False"
WriteCellLoc "B3", "=B1+B2", "False"
WriteCellLoc "C1", "=B1/B3", "True"
WriteCellLoc "C2", "=B2/B3", "True"
WriteCellLoc "D1", "=Success!B1+0", "False"
WriteCellLoc "D2", "=Failure!B1+0", "False"
WriteCellLoc "D3", "=SUM(D1:D2)", "False"
WriteCellLoc "E1", "=D1/D3", "False"
WRiteCellLoc "E2", "=D2/D3", "False"
FormatRange "C1:C2", "0.0%", ""
FormatRange "D1:D3", "#,##0""mb""", ""
FormatRange "E1:E2", "0.0%", ""
Else
'Trim the fat
DeleteWorksheet "Sheet3"
End If
'Work section
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(RootPath)
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder In colSubfolders
Bytes = objFSO.GetFolder(objSubfolder).Size
Result = Int((Bytes/1024)/1024)
If Result > ResultLimit Then
Write2CellAdv "Failure", objSubfolder, Result
If NOTIFY_ADMIN_FAILURE Then
'Make Noise
PlayWav "C:\WINNT\Media\chord.wav"
End If
Else
Write2CellAdv "Success", objSubfolder, Result
If NOTIFY_ADMIN_SUCCESS Then
'Make Noise
PlayWave "C:\WINNT\Media\ding.wav"
End If
End If
Next
If SUMMARY_OF_WORK Then
' Create a new sheet to summarize results of run
GotoWorksheet "Summary"
End If
If NOTIFY_ON_COMPLETION Then
'Make Noise
PlayWav "C:\WINNT\Media\Windows Logoff Sound.wav"
End If
Sub TextFileIntoArray(FileName,ArrayName)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oList = oFSO.OpenTextFile(FileName, 1, False, False)
ArrayName = Split(oList.ReadAll, vbCrlf)
oList.Close
End Sub
Sub FormatRange(Range,Format,Width)
objExcel.ActiveSheet.Range(Range).Select
If Format <> "" Then
objExcel.Selection.NumberFormat = Format
End If
If Width <> "" Then
objExcel.Columns(Range).ColumnWidth = Width
End If
End Sub
Sub PlayWav(sWaveFile)
Set oShell = CreateObject("Wscript.Shell")
oShell.Run "sndrec32 /play /close """ & sWaveFile & """",0,True
End Sub
Sub WriteCellLoc(Loc,Value,Bold)
objExcel.ActiveSheet.Range(Loc).Activate
objExcel.ActiveCell.Value = Value
objExcel.ActiveCell.Font.Bold = Bold
End Sub
Sub Write2CellAdv(SheetName,Value1,Value2)
objExcel.Sheets(SheetName).Select
objExcel.ActiveCell.Value = Value1
objExcel.ActiveCell.Offset(0,1).Value = Value2
objExcel.ActiveCell.Offset(1,0).Activate
End Sub
Sub GotoWorksheet(SheetName)
objExcel.Sheets(SheetName).Select
objExcel.ActiveSheet.Range("A1").Activate
End Sub
Sub RenameWorksheet(OldSheet, NewSheet)
objExcel.Sheets(OldSheet).Select
objExcel.ActiveSheet.Name = NewSheet
objExcel.ActiveSheet.Range("A1").Activate
End Sub
Sub GotoCell(Location)
objExcel.ActiveSheet.Range(Location).Activate
End Sub
Sub AdvanceLine(Down,Across)
objExcel.ActiveCell.Offset(Down, Across).Activate
End Sub
Sub MilDate(Variable)
Variable = Day(Now) & Left(Month(Now), 3) & Right(Year(Now), 2)
End Sub
Sub CompressFolder(Folder)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where name = '" & Folder & "'")
For Each objFolder In colFolders
errResults = objFolder.Compress
Wscript.Echo errResults
Next
End Sub
Sub UncompressFolder(Folder)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where name = '" & Folder & "'")
For Each objFolder In colFolders
errResults = objFolder.Uncompress
Wscript.Echo errResults
Next
End Sub Tag: Scripting firewall rule change Tag: 153699
Is it possible to script a rule change on an external firewall utilizing the WMI SNMP provider? If so, how do I do this