Monitor opening of particular extension
How can I monitor files with a particular extension. If the files are
opened it pops up with a message box with a yes or no button. Yes opens
the file no stops the files from opening.
any ideas greatly appreciated Tag: Some questions about VBscript in outlook Tag: 200230
How to obtain computer name longer than 15 characters?
How can I obtain the longer computer name of a computer via vbscript?
All techniques I've seen so far only return the NetBIOS name, which is
15 characters max. Windows has supported computer names up to 63
characters long since at least Windows 2000. Most computers on my
network have computer names longer than 15 characters.
Thanks.
Brent Gardner
Network Administrator
IPRO Tech, Inc. Tag: Some questions about VBscript in outlook Tag: 200228
Hi all
Hi,
I want to be able to put this in a script and put it on the desktop:
C:\WINDOWS>psexec -d -i -e -u Administrator cmd /c start sysdm.cpl
What would be the current cyntax to run this as a vbs script?
Thanks,
SA. Tag: Some questions about VBscript in outlook Tag: 200227
Using XML DOM to update machine.config
Hello all.
The following lines are an excerpt from a machine.config file:
<configuration>
<system.net>
<connectionManagement>
<add address="*" maxconnection="10"/>
</connectionManagement>
</system.net>
<system.web>
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="machine"
password="AutoGenerate"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="100"
maxIoThreads="100"
minWorkerThreads="50"
/>
</system.web>
</configuration>
I'm using the following VBScript to edit the machine.config file and
change the "maxconnection" value from 10 to 48:
Dim strServer, XMLFilePath, XMLFileName, XMLFile, XMLFileBak
strServer = "000-WEB15-CRS"
XMLFilePath = "\\" & strServer & _
"\C$\Winnt\Microsoft.NET\Framework\v1.1.4322\CONFIG\"
XMLFileName = "machine.config"
XMLFile = XMLFilePath & XMLFileName
XMLFileBak = XMLFileName & "_Backup_" & ".txt"
Set xmlDoc = CreateObject("Msxml.DOMDocument")
xmlDoc.async = False
xmlDoc.PreserveWhitespace = True
xmlDoc.load XMLFile
'~~~ Create backup of original XML file
Set objFSO = CreateObject("Scripting.FileSystemObject")
CreateObject("Scripting.FilesystemObject") _
.GetFile(XMLFile).Name = XMLFileBak
Dim strNode, strKeyName, strNewValue
strNode = "/*/*/*/*[@address=" & Chr(34) & "*" & Chr(34) & "]"
strKeyName = "maxconnection"
strNewValue = "48"
Set objNode = xmlDoc.selectSingleNode (strNode)
objNode.setAttribute strKeyName, strNewValue
xmlDoc.Save XMLFile
Set xmlDoc = nothing
Set objFSO = nothing
Set objNode = nothing
The script works fine, except for one thing. The whitespace appears to
be preserved throughout the machine.config file - except for the
"<processModel" section. This section gets changed - the entire section
ends up on one horizontal line:
<processModel enable="true" timeout="Infinite"
idleTimeout="Infinite" shutdownTimeout="0:00:05"
requestLimit="Infinite" requestQueueLimit="5000" restartQueueLimit="10"
memoryLimit="60" webGarden="false" cpuMask="0xffffffff"
userName="machine" password="AutoGenerate" logLevel="Errors"
clientConnectedCheck="0:00:05" comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate" responseDeadlockInterval="00:03:00"
maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50"/>
Any idea what's causing this? Any help would be greatly appreciated.
Thanks!
- Dave Tag: Some questions about VBscript in outlook Tag: 200225
On Not in List script problem
Thanks in advance for any help!
I have the following script for a field called DialUpAccess in my Microsoft
Access database. This is a combo box that can look up entered values
(repeating values) or should allow values that were not previously not in
the list to be added.
The properties of the combo box are listed below:
The Control Source is 'DialUpAccess'
The Row Source Type is 'Value List'
The Row Source has this, "NetOP";"PC Anywhere";"RAS"
Limit to list is 'No'
Auto Expand is 'Yes'
Enabled is 'Yes'
Locked is 'No'
The 'On Not in List' event procedure is listed below:
Private Sub ComboDialup_NotInList(NewData As String, Response As Integer)
'Adds a remote access type that is not in the list to the list, if the user
wishes to do so.
Dim strMessage As String
Dim intAnswer As Integer
strMessage = "'" & [NewData] & "' is currently not in your list. Do you wish
to add it?"
intAnswer = MsgBox(strMessage, vbOKCancel + vbQuestion)
If intAnswer = 1 Then
Set dbsVBA = CurrentDb
Set rstKeyWord = dbsVBA.OpenRecordset("Hardware")
rstKeyWord.AddNew
rstKeyWord!ComboDialup = NewData
rstKeyWord.Update
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
End Sub
Does anyone know what my problem here is?
Thanks again, Randy Tag: Some questions about VBscript in outlook Tag: 200224
VBScript Create AD users
I am making a script that programatically creates user accounts in
Active Directory. I can create users without any problems. The issue
is I would like to append a # to the user ID if it already exists in
AD. For Example, jsmith already exists so if Joe Smith joins the
company his samAccountName should be jsmith2. I cannot get that part
of the scripting. If anyone has a code snippet related to that issue
it would be greatly appreciated. Just as a note: I cannot pull from
Excel so altering the id's there is out. I need it to all be contained
in the script. Tag: Some questions about VBscript in outlook Tag: 200223
Preventing interruptiong of Logon Script
Hello any and all knowledgable script writers:
I am hoping you can help me with a vbs login script I am writing to map
network drives. I am done, but the only problem I am facing is that if
the user cannot touch the computer (i.e. launch outlook) because the
script is interrupted and it doesn't map the drives. Is it possible
to code something that will render any user input void until the script
is completed running? I guess the question is, what do I need to add to
the vbs to make the script uninterruptible? Any and all help is greatly
greatly appreciated!! Thank you!
-- Marivi Tag: Some questions about VBscript in outlook Tag: 200221
how to add category to contact
How do I access outlook 2003 contacts in a contact folder and add category
by vbscript of course?
I suppose I can open the outlook object. I am stuck searching for reference
and sample.
Please help. thank you for your time Tag: Some questions about VBscript in outlook Tag: 200220
Trouble with UserAccounts.CommonDialog and Multiple File Selection
Hey y'all,
I've been reading and reading and I can't get this to work. I want to
select multiple files from a dialog and then do stuff to them. Here's
the code I am using:
Sub Command1_Click()
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filename = ""
objDialog.Filter = "All Files|*.*"
objDialog.Flags = &H200 + &H80000 + &H200000
objDialog.ShowOpen
FileNames = Split(objDialog.Filename, vbNullChar)
MsgBox FileNames(0)
MsgBox FileNames(1)
End Sub
Result: After running this and selecting two files, FileNames(0)
contains the path and I get an error at MsgBox FileNames(1) saying it
is out of range. Suggestions?
Lost and Hopeless,
Drew Tag: Some questions about VBscript in outlook Tag: 200219
Login Script
HI guys and gals,
I'm trying to get a login script I have put together working... It's an
amalgamation of scripts I have found online. My goals are:
1: Automate Network Printer deployment based upon user group
membership. Printer lists will be stored in text files, one for each
group.
2: Automate Network Drive deployment, again based on group membership.
Network shares and drive letters are specified in a text file.
3: Display a login prompt.
I've almost got this working but there are a couple of problems:
1: Printer assignment works, but the text file must be in alphabetical
order... maybe there is a better way to do this? Possibly using a
similar loop to the Netwrk Share
2: The network share is not working at all. I had it working simillaly
to the printer Sub but noticed the alphabetical problems .
Any help with this would be greatly apreciated.
I have pasted the code below to the script... it is long. Below this
are examples of the text files.
========================================================================
'Test VBS Login Script
'*******Determin Active Directory Account Information by binding to the
user object in AD***********
' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_DOMAIN = 1
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1179 = 1
Dim Filesystem
Dim InPutFile
Dim arrname
Dim clPrinters
Dim strPrinterName
Dim printer_file
Dim network_share_file
Dim strNetworkShare
Dim strDriveLetter
Dim clshares
Set objNetwork = CreateObject("Wscript.Network")
'Retrieve Computer Name
strComputerName = objNetwork.ComputerName
' Retrieve user NT logon name.
strNTName = objNetwork.UserName
' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use the NameTranslate object to find the NetBIOS domain name from the
' DNS domain name.
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_TYPE_NT4, strDNSDomain
objTrans.Set ADS_NAME_TYPE_1179, strDNSDomain
strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
objTrans.Init ADS_NAME_INITTYPE_DOMAIN, strNetBIOSDomain
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(ADS_NAME_TYPE_1179)
' Bind to the user object in Active Directory with the LDAP provider.
Set objUser = GetObject("LDAP://" & strUserDN)
' Display various names.
'************** Find current time and date and display login
prompt****************************
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LocalTime")
For Each objItem in colItems
intMonth = objItem.Month
intDay = objItem.Day
intYear = objItem.Year
dtmDate = intMonth & "/" & intDay & "/" & intYear
intHour = objItem.Hour
If intHour < 12 Then
text1 = "Morning"
ElseIf intHour => 12 And intHour < 18 Then
text1 = "Afternoon"
ElseIf intHour > 18 Then
text1 = "Evening"
End If
intMinutes = objItem.Minute
If intMinutes < 10 Then
intMinutes = "0" & intMinutes
End If
intSeconds = objItem.Second
If intSeconds < 10 Then
intSeconds = "0" & intSeconds
End If
dtmTime = intHour & ":" & intMinutes & ":" & intSeconds
MsgBox ("Good " & text1 & " " & objUser.givenName & " " &
objUser.sn & " and welcome to the Spicers European Network." _
& vbCRLF _
& vbCRLF & "You are logging into computer " & strNetBIOSDomain &
"\" & strComputerName & "." & vbCRLF _
& vbCRLF & "The current date and time is: " & dtmDate & " " &
dtmTime _
& vbCRLF _
& vbCRLF & "Please note that all system usage is monitored and that
by clicking OK below, you"_
& vbCRLF & "confirm that you understand & accept this as part of
the SPICERS IT User Policy."_
& vbCRLF & "Please note that this policy is subject to periodic
update and you are advised"_
& vbCRLF & "to refresh yourselves with the contents of the policy
on a regular basis."_
& vbCRLF _
& vbCRLF & "A copy of the IT User Policy can be found in:"_
& vbCRLF & "Public folders/Employee policies & Procedures/IT User
Policy - Spicers Limited")
Next
'*******Establish group membership and process script based upon AD
group Membership***********
If IsMember("Domain Admins") Then
WScript.Echo "Member of Domain Admins = Yes"
printer_file = "domain_admins_printers.txt"
Install_NetPrinters
Install_Printer
network_share_file = "domain_admins_shares.txt"
Install_NetShares
Install_Share
End If
If IsMember("Retriever") Then
WScript.Echo "Member of Retriever = Yes"
Else
WScript.Echo "Member of Retriever = No"
End If
If IsMember("Euro") Then
WScript.Echo "Member of Euro = Yes"
Else
WScript.Echo "Member of Euro = No"
End If
Function IsMember(strGroup)
' Function to test one user for group membership.
' objUser is the user object with global scope.
' strGroup is the NT Name of the group to test.
' objGroupList is a dictionary object with global scope.
' Returns True if the user is a member of the group.
Dim objGroup
If IsEmpty(objGroupList) Then
Set objGroupList = CreateObject("Scripting.Dictionary")
objGroupList.CompareMode = vbTextCompare
For Each objGroup In objUser.Groups
objGroupList(objGroup.sAMAccountName) = True
Next
End If
IsMember = objGroupList.Exists(strGroup)
End Function
'********************************* Printers Functions
********************
Sub Install_NetPrinters
Set clPrinters = objNetwork.EnumPrinterConnections
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
ForReading = 1
Set InPutFile = FileSystem.OpenTextFile(printer_file,ForReading, False)
'Overwrite Flag
intInstallPrinterFlag = 0
End Sub
Sub Install_Printer
While not InPutFile.atEndOfStream
If clPrinters.Count <= 0 Then
uname = InPutFile.ReadLine()
arrname = Split (uname,"")
strPrinterName = arrname(0)
Wscript.Echo "Printer: " &
strPrinterName & " Does Not Exist"
objNetwork.AddWindowsPrinterConnection
strPrinterName
'To Set this printer as a default
printer enable the next line
'objNetwork.SetDefaultPrinter
strPrinterName
WScript.Echo "Installing " &
strPrinterName
'Now, if there is a printer installed
and the install printer flag
is set, then remove the existing printer and re-install it.
ElseIf clPrinters.Count > 0 Then
'To display current printers
For i = 0 to clPrinters.Count -1 Step 2
Wscript.Echo "Query returned: "
& clPrinters.Item (i + 1)
uname = InPutFile.ReadLine()
arrname = Split (uname,"")
strPrinterName = arrname(0)
If lcase(clPrinters.Item (i +
1)) = lcase(strPrinterName) then
Wscript.Echo "Printer
connection to " & strPrinterName & "
Exists, checking Re-Install Flag"
If
intInstallPrinterFlag = 1 Then
WScript.Echo
"Printer connection to " & strPrinterName &
"exists, re-install flag SET. Removing and re-installing."
objNetwork.RemovePrinterConnection strPrinterName
objNetwork.AddWindowsPrinterConnection strPrinterName
WScript.Echo
"Installing " & strPrinterName
Else
WScript.Echo
"Printer connection to " & strPrinterName &
"exists, but re-install flag NOT SET, discarding."
End If
Else
Wscript.Echo "Printer
connection to " & strPrinterName & " does
not exist"
objNetwork.AddWindowsPrinterConnection strPrinterName
WScript.Echo
"Installing " & strPrinterName
End If
Next
'If Exist
objNetwork.WindowsPrinterConnection strPrinterName Then
'WScript.Echo "PRINTER DOES NOT EXIST,
INSTALLING"
'objNetwork.AddWindowsPrinterConnection
strPrinterName
'ElseIf
'To Set this printer as a default
printer enable the next line
'objNetwork.SetDefaultPrinter
strPrinterName
End If
Wend
'Clean Up
Set InPutFile = Nothing
Set FileSystem = Nothing
uname = Nothing
arrname = Nothing
strPrinterName = Nothing
End Sub
'***********************************************************************************************
'*************************** Network Drive Sub
********************************************
'Can be the same as above but needs to use network_share_file variable
for the InPutFile
Sub Install_NetShares
Wscript.Echo "Running Install_NetShares"
Set Filesystem = WScript.CreateObject("Scripting.FileSystemObject")
ForReading = 1
Set InPutFile = Filesystem.OpenTextFile(network_share_file,ForReading,
False)
Wscript.Echo network_share_file
End Sub
Sub Install_Share
Wscript.Echo "Running Install_Share"
'Overwrite Flag
intRemapShare = 1
Set fso = CreateObject("Scripting.FileSystemObject")
While not InPutFile.atEndOfStream
Wscript.Echo "Running While Loop"
For Each d in fso.drives
If d.sharename <> "" Then
wscript.echo d.driveletter,
d.sharename
'Wscript.Echo "Query returned:
" & clshares.Item (i + 1)
uname = InPutFile.ReadLine()
arrname = Split (uname,",")
strDriveLetter = arrname(0)
strNetworkShare = arrname(1)
If lcase(d.sharename) =
lcase(strNetworkShare) then
Wscript.Echo "Network
Drive connection to " & strNetworkShare &
" exists, checking Re-Install Flag"
If intRemapShare = 1
Then
WScript.Echo
"Network Drive connection to " & strNetworkShare &
" exists, re-install flag SET. Removing and re-installing."
WScript.Echo
"Removing: " & strDriveLetter & ":"
objNetwork.RemoveNetworkDrive strDriveLetter & ":",True
WScript.Echo
"Drive Removed"
WScript.Echo
"Mapping " & strNetworkShare
objNetwork.MapNetworkDrive strDriveLetter & ":",
strNetworkShare
Else
WScript.Echo
"Network Drive connection to " & strNetworkShare &
" exists, but re-install flag NOT SET, discarding."
End If
Else
Wscript.Echo "Network
Drive connection to " & strNetworkShare &
" does not exist"
WScript.Echo "Mapping "
& strNetworkShare
objNetwork.MapNetworkDrive strDriveLetter & ":", strNetworkShare
WScript.Echo "Done "
End If
Else
MsgBox "Crap"
uname = InPutFile.ReadLine()
arrname = Split (uname,"")
strDriveLetter = arrname(0)
strNetworkShare = arrname(1)
Wscript.Echo "Network Drive
connection to: " & strNetworkShare &
" Does Not Exist"
WScript.Echo "Mapping " &
strNetworkShare
objNetwork.MapNetworkDrive
strDriveLetter & ":", strNetworkShare
End if
Next
Wend
msgbox "While End"
'Clean Up
Set InPutFile = Nothing
Set fso = Nothing
uname = Nothing
arrname = Nothing
strNetworkShare = Nothing
intRemapShare = Nothing
End Sub
=======================================================================
domain_admins_shares.txt:
V,\\SPICFP\DomAdmins$\BradfordC
J,\\SPICFP\NETLOGON
domain_admins_printers.txt:
\\spicprt\XPSYS_PRINT1
\\spicprt\OPS$PRINT
This is a first attempt at WSH, so forgive any silly errors.
I am trying to detect currently installed Shares and
Printers in order to avoid re-installing them unless a reInstall flag
is set.
Thanks again :)
-Chris Tag: Some questions about VBscript in outlook Tag: 200214
Copying email attachments to a specific folder
Is there a way to set up a script that will look in a folder (in Microsoft
Outlook), and do the following:
1) See if there's a message in it (a rule is already set up to copy
messages from a particular sender to that folder).
2) If it's there to copy the attachment to a specific folder on my Windows
2003 server.
3) Rename the attachment with that of the subject line.
4) Delete the e-mail from the folder.
Any suggestions?
Thanks,
Glenn Tag: Some questions about VBscript in outlook Tag: 200212
Automate Interaction With Webpage
Hello,
I am trying to automate an interface to this website:
http://www.class.noaa.gov/nsaa/products/upload which conforms to the
DOM.
I have managed to login and to load all document elements into an
object collection, but am having difficulties interacting with these
elements beyond the .Click() method.
1) Presuming I have loaded all elements on the page into oCollection. I
then try to search through the elements Name property to match
"uploaded_file" which is the input_file object.
iCount = 0
Do
Set oElement = oCollection(iCount)
iCount = iCount + 1
Loop Until oElement.Name = "uploaded_file"
The above code does not work. Is it because some elements on the page
do not have a Name property? How to Fix?
2) If I manage to find the correct object will the following code be
enough to set the file to upload and move on to the next page?
oElement.Value = filename
oElement.Click()
3) Is there a more simple way to set/get element name/property pairs
that having to parse the entire page? I know the element's name is
"upload_file".
4) There are two submit button on the page, but only one is named. How
do I find and activate the unnamed one?
5) Is it better to use the Microsoft.XMLHTTP object for my purposes?
6) Can anyone point me to an online reference relevant to what I am
trying to do that is more illustrative than the MSDN pages? I do not
know exactly what the topic should be. Is it DOM, ASP or something
else? I need a gentle primer.
Thanks Tag: Some questions about VBscript in outlook Tag: 200210
VBScript That Checks To See If Folder Exists (Loop Of Computers)
I was wondering if anyone could help me create a VBScript the with
check a list of remote computers to see if a folder exist and input
that information in a text file it does or not Tag: Some questions about VBscript in outlook Tag: 200207
Create a Folder on the users Desktop
Im new to VBS Scripting, and I was assigned the task of converting our
batch files into VBSScript since we went to Active Directory 6 months
ago.
I can map drives and get a user and group membership (I think). But
what I am stumped at is checking for the existence of a LINKS folder on
the users desktop, and if it isnt there, create it. Then I need to dump
shortcuts and links into it depending on group membership.
In batch, I can use the %userprofile% command (in fact, here is a
snippet of batch that we use...)
Echo Checking Links Folder...
IF NOT EXIST "%userprofile%\desktop\Links" MKDIR
"%userprofile%\desktop\Links"
copy "\\DCSERVER\NETLOGON\LINKS\*.*" "%userprofile%\desktop\Links"
How could I make this into a logon script? This is one of the first
commands I use. Any help would be appreciated. I have looked for a VBS
Snippet on the net (Microsoft, VBSScripting.com and many others) but
could not find this. I can't believe I'm the only one who wants to do
this during login. Seems pretty basic to me that an Admin would want to
do this (at least in a K-12 school environment). Anyway Please help
me... Tag: Some questions about VBscript in outlook Tag: 200205
VB Wait...
Hi all,
Below is a section of VBA that I have written, and basically I would
like to
get rid of the application.wait lines of code and replace these with
code
that checks that the program in question (cmd.exe) is idle before
continuing.
If anybody can offer a suggestion as to how I can do this, or any other
method that would give good results, please let me know,
Private Sub CommandButton1_Click()
Shell ("C:\Windows\system32\cmd.exe")
Application.Wait Now + TimeValue("00:00:03")
SendKeys "net send " & (TextBox1) & " " & (TextBox2) & "{Enter}"
Application.Wait Now + TimeValue("00:00:05")
SendKeys "Exit" & "{Enter}"
Unload Me
End Sub
Many Thanks,
Mark Tag: Some questions about VBscript in outlook Tag: 200200
Different scripts at logon
I am very new to scripting. I would like to run different scripts at logon
for different users. Script "A" would run when user "A" logged on, script
"B" would run when user "B" logged on. Is this possible?
Thanks, Tag: Some questions about VBscript in outlook Tag: 200196
Inconsistent Results
Hello,
I have written a vbscript - actually an HTA, which checks to see if a
user is a member of an AD group. For some users it will correctly
return the correct results. For others it will say that a user is not a
member of a group when actually they are. When looking at group
membership through the Active Directory snap in it shows the correct
membership. At first I thought the issue might be something to do with
the Domain Controller the script was interrogating, however looking on
those DC's with the AD snap in also shows the correct membership. It is
worth mentioning that newer accounts dont seem to return the correct
results. The only thing that needs to be changed in the HTA is
"strNetBIOSDomain = "DOMAIN"" and replace DOMAIN with your correct
Domain name.
Here is my HTA:
<html>
<head>
<title>HTA Helpomatic</title>
<HTA:APPLICATION
ID="objHTAHelpomatic"
APPLICATIONNAME="HTAHelpomatic"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<SCRIPT Language="VBScript">
Sub RunScript
strGroup = group.value
strGroupText = group.value
strUser = user.value
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Dim objTrans, objShell, objGroup
Set objShell = CreateObject("Wscript.Shell")
strNetBIOSDomain = "DOMAIN"
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strUser
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strGroup
strGroupDN = objTrans.Get(ADS_NAME_TYPE_1779)
'msgbox struserdn
'MsgBox strGroupDN
'MsgBox """" & "LDAP://" & strGroupDN & """"
'strGroupDN = """" & "LDAP://" & strGroupDN & """"
strGroupDN = "LDAP://" & strGroupDN
'MsgBox strGroupDN
Set objGroup = GetObject(strGroupDN)
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("member")
StrCompare = struserdn
For Each strMember in arrMemberOf
intCompare = StrComp(StrCompare, strMember, vbTextCompare)
If intCompare = 0 Then
MsgBox "User is a member of the " & strGroupText & "
group",,"Group Information"
Exit For
End if
Next
If intCompare <> 0 Then
MsgBox "User is not a member of the " & strGroupText & " group",,"Group
Information"
End If
End sub
</SCRIPT>
<body>
<font color="red">
<face ="Times New Roman">
<H1 align="center"font color="red"> Is User Member of Group </H1>
<font color="blue" face="Times New Roman" size="4">User
<input type="text" name="User" size="25">
<font color="blue" face="Times New Roman" size="4">Group
<input type="text" name="Group" size="25">
<br>
<br>
<input id=runbutton class="button" type="button" value="Get Info"
name="run_button" onClick="RunScript">
</body>
</html>
Many thanks for any assistance,
Ben Tag: Some questions about VBscript in outlook Tag: 200194
Invoke interative process
I m using Win32_ScheduledJob to invoke interative process. May i know
how can i change the working directory, so that the .exe file can run
from that directory. Thanks.
-chailee- Tag: Some questions about VBscript in outlook Tag: 200192
2D VBScript Array from a String w/ Record and Field Delimiters
I've been struggling with generating a 2D array from a string. Perhaps
someone can shed some light on the process or point me in the right
direction...
The string in question looks something like this:
1[/field]Penguins[/field][/record]2[/field]Skuas[/field][/record]5[/field]Eagles,
Golden[/field][/record]
I know this is a rather odd string, but suffice it to say its generated
to represent a series of records which cannot be retrieved via typical
ASP/ADO recordset fashion. The environment is classic ASP using
VBScript.
I can readily break this up into a 1D array using
split(str,"[/record]").
But this yields only the 3 combined sets:
1[/field]Penguins[/field]
2[/field]Skuas[/field]
5[/field]Eagles, Golden[/field]
What I'm looking for is a way to make this a 2D array such that:
aryBirds(0,0) = 1
aryBirds(0,1) = Penguins
aryBirds(1,0) = 2
aryBirds(1,1) = Skuas
aryBirds(2,0) = 5
aryBirds(2,1) = Eagles, Golden
Unfortunately my searching thusfar hasn't hit on what looping is
required to get this 2D result.
So far I've tried things like
For i = 0 to Ubound(aryCombinedSets)-1
aryNewSets = split(aryCombinedSets(i),"[/field]")
For j=0 to Ubound(aryNewSets)-1
aryBirds(i,j) = (aryNewSets(j), j)
Next
Next
But these only generate the last 2 values of the array. That is only
the 5 and Eagles, Golden values are retrievable.
I have several similar strings. In each case I know how many fields
exist, but the number of records varies. In each case I need to make a
2D array so that values can be individually manipulated.
Any assistance or pointers in the right direction would be helpful.
Thanks!
Bonnie Tag: Some questions about VBscript in outlook Tag: 200188
ASP: using Chr to display big 5 character
I am using windows 2003 server english version. I got the folloing message
when I put a big5 code to CHR function to get a ANSI character
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'Chr'
I found that i cannot pass a number greater than 255 to the function. The
code works before in windows 2000 server traditional chinese version. Is
there any function/code I could use to translate a 2-bytes big5 code to utf-8
code? Tag: Some questions about VBscript in outlook Tag: 200186
See if computer is active and connected
What's the best way to make a script that regularly checks to see if a
computer on the network is active and connected? I've been using a script
that does the simple ping cmd every 30 seconds, but I'd like something
proper and better.
Thanks Tag: Some questions about VBscript in outlook Tag: 200183
Task Scheduler & VBS
Hello!
I run a script using the Windows Task Scheduler with this comand line in
the job MyTask.job
wscript "d:\myscript.vbs"
That's fine!
But how can I know the name of the task who call the script? (in this
example, it would be MyTask.job).
I think I can use the log file of the Sheduler but does anyone know
another way to do this inside myscript.vbs ?
Thanks Tag: Some questions about VBscript in outlook Tag: 200178
IADsComputer [adsi] interface using vbscript conundrum
Can anyone please help me figure out what is missing from this Microsoft
documentation?
1) Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadscomputer.asp
I have worked through the fact that the LDAP ADSI provider does not support
the IADsComputer interface; the documentation claims that "The IADsComputer
interface is not implemented by the LDAP ADSI provider".
However the properties "OperatingSystem" and "OperatingSystemVersion" *are*
available. Why?.
2) Reference:
http://msdn.microsoft.com/library/en-us/adsi/adsi/provider_support_of_adsi_interfaces.asp
Now, this is a great page because it summarises the fact that in order to
get the other IADsComputer methodes and properties, we need to use the WinNT
provider, which is detailed at this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/adsi_objects_of_ldap.asp
The documentation at this page does not clearly indicate whether the WinNT
provider is connecting to the actual physical computer or Active Directory
with the WinNT://<domain name>/<server> ADsPath string. Which is it?
3) Using the WinNT provider, the properties documented at this page (
http://msdn.microsoft.com/library/en-us/adsi/adsi/iadscomputer.asp ) are
supposed to be available, but they are NOT.
This has me very puzzled; I have checked the "Requirements" but find nothing
missing. I have been through the docs time & time again, but something is
missing! See below...
Example:
Set oADSystem = GetObject
("LDAP://DC001/CN=MYSVR,OU=domain_servers,dc=contoso,dc=msft")
Wscript.Echo "Active Directory Attributes"
Wscript.Echo "ADsPath:" & oADSystem.ADsPath
Wscript.Echo "Class:" & oADSystem.Class
Wscript.Echo "OperatingSystem:" & oADSystem.OperatingSystem
Wscript.Echo "OperatingSystemVersion:" & oADSystem.OperatingSystemVersion
Wscript.Echo
Set oPhSystem = GetObject ("WinNT://contoso.msft/MYSVR,Computer")
Wscript.Echo "Physical Machine Attributes"
Wscript.Echo "Name:" & oPhSystem.Name
Wscript.Echo "Model:" & oPhSystem.Model
Result:
Active Directory Attributes
ADsPath:LDAP://DC001/CN=MYSVR,OU=domain_servers,dc=contoso,dc=msft
Class:computer
OperatingSystem:Windows Server 2003
OperatingSystemVersion:5.2 (3790)
Physical Machine Attributes
Name:MYSVR
E:\Temp\adaudit\test.vbs(11, 1) Active Directory: The directory property
cannot be found in the cache.
(I have a hrd time believing the the server does not have a "Model"
attribute. Same error for the other properties: MemorySize, Processor,
ProcessorCount, StorageCapacity, etc.)
What am I missing? Anyone?
Thanks in advance
--Maarten Veerman Tag: Some questions about VBscript in outlook Tag: 200175
Bulk import DNS
Hello, I was wondering if anyone out there has a snippet that will do a
build the framework for a mass import of DNS entries (AD intigrated),
we need to add over 1700 entries.
Any help would be great.
Thanks.
Terry. Tag: Some questions about VBscript in outlook Tag: 200174
Remotely change Display Resolution Using script
Is there a way to create a script that will do the following?:
Create a list of computers that this script will affect. The script
would change Resolution from 1024x768 to 800x600 automatically. And I
would create another script to change it back. Tag: Some questions about VBscript in outlook Tag: 200173
Remotely change Display Resolution Using script
Is there a way to create a script that will do the following?:
Create a list of computers that this script will affect. The script
would change Resolution from 1024x768 to 800x600 automatically. And I
would create another script to change it back. Tag: Some questions about VBscript in outlook Tag: 200172
Using ADO DB to Manipulate Space Character Filled Strings
I'm attempting to use ADO to manipulate data in fixed width text files
as shown here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/f65b4a7c-eb8c-47f1-ba36-16ad8793026d.asp
The issue I run into is that the fields which are all spaces or have
trailing spaces end up with the spaces as null. Is there a way to
force the OLE DB provider to bring them in as space characters? For
example, store 2 spaces if the 2 character field is 2 spaces in the
fixed width import file.
Included below is an excerpt of my script and schema.ini file. I have
tried changing the field type to text in the .ini file and obtained the
same result.
Script:
On Error Resume Next
' Assign constants
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Const FOR_APPENDING = 8
' Assign file string variables
strPathtoTextFile = "E:\Temp\"
strOutputTextFile = "temp.txt"
strToHostFile = "ALL_TOHOST.txt"
' Create ADO objects
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
' Create file system object for handling text files
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Open output text file
Set objTextFile = objFSO.OpenTextFile _
(strPathtoTextFile & strOutputTextFile, FOR_APPENDING, True)
Wscript.Echo "Opening OLEDB Connection"
' Open connection for input text file with OLEDB driver
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=NO;FMT=FixedLength"""
Wscript.Echo "Selecting Records"
' Select records from input file
objRecordset.Open "SELECT * FROM " & strToHostFile, _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
' Obtain field count
strFieldsCount = objRecordset.Fields.Count
' Build record string and write to file
If strFieldsCount > 0 Then
Do Until objRecordset.EOF
For intLoop = 0 To (strFieldsCount - 1)
strRecord = strRecord & objRecordset.Fields.Item(intLoop)
Next
objTextFile.WriteLine(strRecord)
strRecord = ""
objRecordset.MoveNext
Loop
End If
objTextFile.Close
Wscript.Echo "Script Complete"
Schema.ini
[ALL_TOHOST.TXT]
ColNameHeader = False
CharacterSet = ANSI
Format=FixedLength
Col1=FIELD1 char Width 1
Col2=FIELD2 char Width 2
Col3=FIELD3 char Width 14 Tag: Some questions about VBscript in outlook Tag: 200171
Best method to figure out if someone is using cached credentials?
Hello,
I'm attempting to write a script that will figure out if a user is
using cached credentials.
What I figured to do is find the logon server, and see if it is the
hostname of the PC, or not. if so, they aren't authenticating to a DC;
if not, they are using cached credentials.
The only problem is this will affect local users, who are obviously
authenticating to the PC itself as well.
Any way to tell if a user is using cached credentials?
Thanks,
Matt
_____________________________________________
Dim objShell, strRegKey
Dim strLogonServer, strComputerName
Set objShell = CreateObject("Wscript.Shell")
Set objEnvProcess= objShell.Environment("PROCESS")
strLogonServer = Right(objEnvProcess.Item("LogonServer"),
len(objEnvProcess.Item("LogonServer"))) - 2)
strComputerName = objEnvProcess.Item("ComputerName")
if strLogonServer = strComputerName then
msgbox "logonserver is the same"
Else
msgbox "You have logged on locally. You may be using cached
credentials."
End If Tag: Some questions about VBscript in outlook Tag: 200169
Excel find row data in every column
Hi,
What I have already is a vbscript that creates and populates an Excel
spreadsheet with multiple columns of data. Now what I require is to
take the data from each row in the each column, and search the other
columns for this data. It then needs to do the same for the second
column, and the third, and so on.
So if I have columns of data, the script will take data from row 1,
column 1 and check to see if that data is in any other cell. It then
needs to tell me which column it is in. Once all the rows from column 1
have been searched for, it then does the same for column 2, column 3,
etc.
Here is what I have so far:
The value y has been set elsewhere and represents the number of
columns.
y = y - 1
i = 4
t = 1
Do Until t = y
'Set range?
Do Until objExcel.Cells(i, t).Value = ""
strName = objExcel.Cells(i, t).Value
Set objSearch = cols.Find(strName)
If objSearch Is Nothing Then
Else
Msgbox y
MsgBox strName & " was found."
End If
i = i + 1
Loop
t = t + 1
Loop
I am having difficulty defining the range to search at the moment. Any
help would be very much appreciated.
Matt Tag: Some questions about VBscript in outlook Tag: 200167
paging Richard Mueller... Richard Mueller, please come to the front desk
Richard,
Sorry to bother you but you have helped me in the past when no one else
could. I have a seemingly simple task but am struggling and becoming
frustrated. In VBScript (that will later be ported to ASP) I need to do the
following:
Prompt for AD username (must be SAMAccountName)
Display that users current Exchange mailbox size in MB
Display the size limit imposed on that users mailbox
The size limit is the biggest problem. If the user is NOT using defaults,
and a custom limit has been set in AD, this should be easy enough to get.
But if the user IS using the default size limit for his mailbox store, I
have no idea how to first figure out what policy governs his store, and then
read the policy to get the imposed limit. If you have an example of this I
would greatly appreciate it.
Thank you Tag: Some questions about VBscript in outlook Tag: 200160
Query Active Directory Ports
we have high security policy in our Data Center and every time installing
New Server and then Active directory i have to check that AD ports are
opened in the firewall or not is there anyway to query Active Directory
opened ports on the remote Server (Parent DC).
Thanks Tag: Some questions about VBscript in outlook Tag: 200157
Vbs for WM2005
Hello
i want to know if vbs exist for PocketPC ?
Beacause i need to find a onboard laguage for both 2000/XP/VISTA and
WM2003/2005
Thanks
--
Vous voulez un conseil ?
Ne faites jamais confiance à ceux qui vous donnent des conseils.(c) Tag: Some questions about VBscript in outlook Tag: 200144
write data to Excel spreadsheet?
Howdy-
I've built some scripts using the FileSystemObject &
CreateTextFile/ReadAll/WriteLine methods that take the contents of local
logfiles (vendor-produced) and write them to another text file in a UNC
path using schtasks.
Now, the user wants the output to be in an excel spreadsheet...
I don't think changing the format to .csv is going to work; the original
logfiles vary between lines with five columns of data and lines with
seven or none at all... Can I do this within the FSO or do I need to
figure out how to use Excel.Application?
Thanks,
BM Tag: Some questions about VBscript in outlook Tag: 200132
need help
Here's what I need to do in a vbscript: If a certain file exists in a
directory, I need to copy it to the backup/archive directory adding the
date to the file name. Example - c:\files\filename.txt to
c:\archives\filename_20061211.dat.
I know how to do this is in DOS but not vbscript.
Thanks.
Chris Tag: Some questions about VBscript in outlook Tag: 200130
exchange script question
hi all.
i need a script that will report 2 things: mailbox size limit, current
mailbox size. does anyone have a quick example? my main concern is getting
the size limit. if this is set via policy in exchange, how can the limit (in
MB) be read?
thanks Tag: Some questions about VBscript in outlook Tag: 200125
VB Script Runs W/O Error, But Does Nothing!
I've used this script in the past to change users Terminal Profile in Active
Directory. This time when I ran it and it went error-free, but did
absolutely noting by way of changing the Terminal Profile. Any ideas?
'**********************************************************************************
'* THIS SCRIPT CHANGES User Profiles *
'* WRITTEN BY KERRY *
'**********************************************************************************
Option Explicit 'Demands that variables are "dimmed".
'On Error Resume Next 'Continue despite errors. (Disable Until Script is
working.)
'Define Variables
Dim objExcel 'Creates Excel Instance
Dim objWorkbook 'Opens designated Excel Workbook
Dim intRow 'Contains the row number of the Excel worksheet.
Dim usrVar 'Contains the new user's full user name.
Dim objOU, strOU, strUser 'Binds to the Organizational Unit Object.
Dim objTermProfile
Dim strTSprofile 'Connect to the object.
Set objExcel = CreateObject("Excel.Application") 'Set the correct file
location for the excel data file.
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Set the class list
address below!!!!
Set objWorkbook = objExcel.Workbooks.Open("C:\Class Lists 2006\9list.xls")
'Open the class list file.
intRow = 2 'Variable for loop. Begins on 2 to bypass header row.
Do Until objExcel.Cells(intRow,1).Value = "" 'Initiate loop.
'Set the Profile Path and the Terminal Services Profile Path for the
account.
strUser=objExcel.Cells(intRow,1).value
Set objTermProfile=GetObject("LDAP://student1/cn=" & strUser & ",ou=Senior
One,dc=mcistudent,dc=local")
objTermProfile.Put
"TerminalServicesProfilePath","\\TERMINAL1\termProfile.man"
objTermProfile.SetInfo
WScript.Echo "The new TprofilePath has been added to " &
objExcel.Cells(intRow,4).Value & "'s account."
intRow = intRow + 1 'Advance to the next row.
Loop 'Repeat the loop.
WScript.Echo "CHANGES TO THE " & StrOU & " ORGANIZATIONAL UNIT ARE
COMPLETE."
objWorkbook.Save 'Save the Excel file.
objExcel.Quit 'Close the Excel thread and End Script Tag: Some questions about VBscript in outlook Tag: 200116
Possible to add user to COM Security?
Is it possible to script adding a user to COM Security in Access
Permissions within DCOM (dcomcnfg)? Tag: Some questions about VBscript in outlook Tag: 200115
help with combining two scripts
Hi,
i am a scripting n00b and found a script i would like to use
to connect to a network share and open the network share.
The script below connects to the network share, but i also would like
explorer to open the "x:" drive after connecting to it.
Can someone please tell me how i can accomplish that in this script?
-->script:
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
' Values of variables set
strDriveLetter = "x:"
strRemotePath = "\\192.168.x.x\blah"
strUser = "user"
strPassword = "password"
strProfile = "false"
' This section creates a network object. (objNetwork)
' Then apply MapNetworkDrive method. Result H: drive
' Note, this script features 5 arguments on lines 21/22.
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, _
strProfile, strUser, strPassword
Thanks!
Kim Tag: Some questions about VBscript in outlook Tag: 200111
create user account in windows
I need a vbscript to create user accounts on a windows computer. Its is
a completely local computer, no domain or anything. I saw this script
on Google groups and found that it works for creating 1 user.
----------------------------------------------------------------------------------------------------------------------------------------------
sNewUser = "mini-strator"
sGroupname = "Users"
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
Set oComputer = GetObject("WinNT://" & sComputerName)
Set oUser = oComputer.Create("user", sNewUser)
On Error Resume Next
' save the user
oUser.Setinfo
' If user exists already, we get an error
If Err.Number = 0 Then
On Error Goto 0
oUser.SetPassword "1234"
oUser.Fullname = "John"
oUser.Description = "hi!"
oUser.Setinfo
End If
On Error Goto 0
' Add the user to the group
Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)
' Use error handling in case he is a member already
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0
----------------------------------------------------------------------------------------------------------------------------------------------
However if I change the username and try to create another user, it
doesn't work. For example if I run the above script once, then change
it to:
----------------------------------------------------------------------------------------------------------------------------------------------
sNewUser = "mini-strator"
sGroupname = "Users"
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
Set oComputer = GetObject("WinNT://" & sComputerName)
Set oUser = oComputer.Create("user", sNewUser)
On Error Resume Next
' save the user
oUser.Setinfo
' If user exists already, we get an error
If Err.Number = 0 Then
On Error Goto 0
oUser.SetPassword "1234"
oUser.Fullname = "Betty"
oUser.Description = "hi!"
oUser.Setinfo
End If
On Error Goto 0
' Add the user to the group
Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)
' Use error handling in case he is a member already
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0
----------------------------------------------------------------------------------------------------------------------------------------------
It does not create a new user with the name Betty, just a user named
John. Someone please help me with this. I need it urgently. Tag: Some questions about VBscript in outlook Tag: 200109
Consolidate Specific Fields in text files to 1 Big File
i'm newbie in VBScripting and i'd create one script to collect system
information and i have other application that generates logs what i need to
do is to have a VBscript that read log files and ONLY copy some fields then
append it to the output file generated by my first script.
Any Help Tag: Some questions about VBscript in outlook Tag: 200106
viewing blobs vbsript asp
Hi
I am trying to set up a view application that will view stored wrd, pdf,
jpg gif files in a larg blob in sql 2000. This is tying in with an older
application that was written by somebody, all i want to do is have 1 view
page that will show a list of the file attachments by id number and if
clicked on will open them in exploer.
thanks
Mike Tag: Some questions about VBscript in outlook Tag: 200103
VBScript That Copies Folder Content To Remote Computers
Is anyone that can help me? I trying to create a VBScript copy folder
to remote computer. I would like the VBScript that check to see if that
folder I want to copy already exist on a remote computer, If the folder
exists, then I would like the VBScript to move on the next computer,
and if the folder doesn't exist I would like it to copy the folder to
that remote computer and possible create a log file telling me which
computers completed successfully and which ones didn't Tag: Some questions about VBscript in outlook Tag: 200101
Read Registry Key
Please give me a simple VBs that will read the values of 1 Registry key >Put them in
some variables or an array > Then i will do something with that .................
What i want to do is :
Read the values of [HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU]
Put a's value in variable a
Put b's value in variable b
c value in c
d in d
etc. etc.
OR .. . ..
Put a's value in array
Put b's value in the array
etc. etc.
.....
AND Put the value of MRUList in a different variable.
--
Ayush Tag: Some questions about VBscript in outlook Tag: 200087
Please Help !! VBscript convert my image/music file into VBscript file
Dear all. I am not sure this is the RIGHT forum, but I hardly need help
from all people who is familiar with VBscript.
I received a email from my friend with attached with a *.vbs file,
which is a image he claimed. After I download the file, the outlook
just asked me to change seomthing, I had choosen NO. But after that, I
found that all my image/music files were changed to VBscript script
file and cannot open it anymore.
I hardly need help to convert the (very important) image files back,
anyone can help me please? Thank you very very very much. Tag: Some questions about VBscript in outlook Tag: 200086
Missing vbscript
Hope this is the right newsgroup - if not, apologies.
I have tried to install iTunes on my WinXP laptop, but the installer
says:"iTunes could not be installed because Visual Basic Script
(VBScript) is not installed or has been disabled...."
I've looked at Services, but there is no sign of VB, and a search
doesn't seem to help.
Any suggestions would be welcome.
Thanks Tag: Some questions about VBscript in outlook Tag: 200084
Call remote vbscript
In order to make the program visible in the desktop, i create another
vbscript in the remote PC. However, there is no response in the remote
PC. May i know any wrong to the scripts below?
remote vbscript
-----------------------
Option Explicit
Dim strProgram, strComputer, objWMIService, arrProcess, objProcess,
objProgram, intSleep, strShell
strProgram = "calc.exe"
strComputer = "."
intSleep = 15000
set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
set arrProcess = objWMIService.ExecQuery("Select * from Win32_Process")
For Each objProcess in arrProcess
if(objProcess.Name = strProgram)then
objProcess.Terminate()
end if
Next
WSCript.Sleep intSleep
set objProcess = objWMIService.Get("Win32_Process")
set objProgram =
objProcess.Methods_("Create").InParameters.SpawnInstance_
objProgram.CommandLine = strProgram
set strShell = objWMIService.ExecMethod("Win32_Process", "Create",
objProgram)
WSCript.Quit
local script
------------------
Dim sScriptName, sComputerName, oWmi, oWmi_Process, objSWbemLocator
sScriptName = "D:\t.vbs"
sComputerName = "abc"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set oWmi = objSWbemLocator.ConnectServer(sComputerName, "root\cimv2",
"abc", "a", "MS_409", "NTLMDomain:WORKGROUP")
Set oWmi_Process = oWmi.Get("Win32_Process")
oWmi_Process.Create(WScript.FullName & " " & sScriptName)
WSCript.Quit Tag: Some questions about VBscript in outlook Tag: 200075
naive question
how can one catch end of file for openastextfile object?
AtEndOfStream is only good for stream and I don't want to use stream because
I want to read line by line Tag: Some questions about VBscript in outlook Tag: 200069
shell.run problems :(
I run a php script on localhost that contains vbscript in it to execute
a program, like so:
<?php
$scripter = new COM("MSScriptControl.ScriptControl");
$scripter->Language = "vbscript";
$scripter->ExecuteStatement("Set WshShell =
createobject(\"wscript.shell\")");
$scripter->ExecuteStatement("oExec =
WshShell.Run(\"someprogram.exe\",1,TRUE)");
$scripter->ExecuteStatement("Set WshShell=nothing");
$scripter=null;
?>
Now, if I have someprogram.exe already running, it will jump to that.
If I don't, it will open up a new instance. Great, it works. However,
the new instance is running as a SYSTEM process, and not my login name.
I trying to automate a printout, and I can't set any settings on the
printer for 'system', so it gets all funky.
I have been searching all freaking day for a solution... is there one?
PLEASE HELP :) Tag: Some questions about VBscript in outlook Tag: 200068
iTunes Script (easy)...
Hey, try this script out for iTunes (must have iTunes installed).
Problem:
iTunes can run minimized in the systray but in order to play,
pause, volume, etc. you have to maximize it (which can be slow
sometimes).
Solution:
Write a script! Try the following. You can make custom keyboard
shortcuts for these scripts also -- make a shortcut on your desktop
and open properties, then make shortcut key by hitting key of
preference).
'Start Script
#######################################################
Set objApp = CreateObject("iTunes.Application")
objApp.PlayPause
'Here are properties to tinker with:
'objApp.Mute = True '(true to mute, false to unmute)
'objApp.SoundVolume = 100 '(values of 0-100)
'or use the following to increment the volume by 10
'units w/each click or hit:
'objApp.SoundVolume = objApp.SoundVolume + 10
'objApp.Rewind '(use objApp.Resume to stop RW)
'objApp.FastForward '(use objApp.Resume to stop FF)
'objApp.BackTrack '(previous track)
'objApp.NextTrack '(next track)
'objApp.Stop '(stops playback)
'objApp.Quit '(exits/closes iTunes) Tag: Some questions about VBscript in outlook Tag: 200065
Help Please
The following has been going on for over a week, and I can't find a
solution:
We send an email to approx. 200 dealers.
The email is generated by a VBScript on a schedule.
The VBScript access' a database for various information.
The email is configured to HTML format.
In the email there are two hyperlinks one to a French URL and one to an
English URL.
[PROBLEM]
When some of the recipients receive the email the hyperlink is broke.
eg. http://www.test.com/test.asp?dealer=1 111
(Spaces in the URL)
Or (this just happened)
eg. http://www.testcom/test.asp?dealer=1 111
(The period between test and com disappeared)
[WHAT I TRIED]
Put the whole thing in table tags with the nowrap attribute.
Tried the <nobr> tag.
Tried the <pre> tag.
Any insight would be very much appreciated. Tag: Some questions about VBscript in outlook Tag: 200057
how do I do if I want to check the status of a checkbox when I click
save and close in an appointment, and then if its true, add some text
to the subject field?