Page not able to display
Dear Experts,
I am trying to link one of my menu to a login screen of my program. After I
create the hyperlink to open the page which is a login page, instead of the
login page display in the window, the entire code is being displayed. I have
checked with the previous code which I don't find difference.
Below is my code:
<table border=0 cellpadding='1' cellspacing=1 width="150"><tr><td width='16'>
<font size="3" face="Times New Roman"><img src='text.gif' width='16'
height='16' hspace='0' vspace='0' border='0'></font></td><td>
<font face="Times New Roman" size="3">
<a target="master" href="Leave_system/applyforleave.asp">Leave
Application</a></font></td></tr></table>
However, when I use CTRL+ click the link in Design mode, the page does
display on the Preview pane. How could or may be the problem to this issue?
Thank you very much.
Regards,
Seok Bee Tag: Write back to AD script. Tag: 181758
navigating a child window in IE
Hi,
I have some info that needs to be uploaded to a vendor's web app every
day, which I'd like to automate this. I am a vbscript newbie. I'm
running into problems when I click on a link which pops up another
window. It seems like the commands I issue afterwards are still going
to the original window. How do I get the script to operate on the
child window?
Set oMSIE = CreateObject("InternetExplorer.Application")
oMSIE.navigate "http://www.myvendor.com"
oMSIE.visible=1
Do Until oMSIE.ReadyState = 4 wscript.sleep 10 : Loop
Set oIEDoc = oMSIE.Document
oIEDoc.links(4).click
' (Child window comes up here and I want commands after this point
' to be directed to it.)
Do Until oMSIE.ReadyState = 4 wscript.sleep 10 : Loop
oIEDoc.getElementById("textUpload").value = "123456789"
Thanks! Tag: Write back to AD script. Tag: 181754
Determine exchange server name
Hi Group,
I am using a small script which uses the CDO.message object to send emails.
The server name is configured by "server.domain.com".
However, for security considerations, it appears that the exchange
administrator regularly changes the name and/or IP of the exchange server.
Our outlook 2003 client doesn't seem to have a problem with this as the
server name is automatically updated in the Outlook Profile.
However, my scripts fail and I was wondering how Outlook was determining
what was the new location of exchange server on the network. Is there a
script for doing that?
TIA Tag: Write back to AD script. Tag: 181752
Implement a read-only class memeber as a Function or a Property?
Hi,
Where does one draw the line between Property Get and Function? They both
do exactly the same thing, do they not?
When should I use Property Get, and when should I use Function?
Jamie Tag: Write back to AD script. Tag: 181744
Running a logon script under another account
Does anyone know how to run a .vbs logon script under a different account
than the account that's logging in? The reason I need to do this is that
the script installs a software package if it's not already installed on the
machine that the user is logging onto. The Active Directory Group Policy
restricts software installation to domain administrators, so I wanted to run
this script with elevated priviledges to get around this restriction imposed
by the Group Policy. Has anyone effectively dealt with a similar issue?
Some background info:
--All client machines are Windows XP Pro
--Main AD Server (Global Catalog) is 2003. Other domain controllers are
2003 and 2000 Tag: Write back to AD script. Tag: 181741
Convert SAM to DN with input/output files
All-
I am trying to add on to a small script I saw posted by Richard
Mueller (www.rlmueller.net).
His script takes the current logged on user's logon name and
determines and displays the DN.
I am attempting instead to have the script read a list of logon names
(sam account names) and go out and determine the DN for each. Output
to be written to a results text file.
I am getting a type mismatch error and I can see the problem is
related to strNTName but I'm not sure how to correct it.
Here is Richard's script (this one works):
Set objNetwork = CreateObject("Wscript.Network")
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 3, strDNSDomain
objTrans.Set 1, strDNSDomain
strNetBIOSDomain = objTrans.Get(3)
' 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 1, strNetBIOSDomain
objTrans.Set 3, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(1)
Wscript.Echo "User DN: " & strUserDN
++++++++++++++++++
Here is the script I am attempting to get working (but not quite there
yet):
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\results.txt", ForAppending, True)
'Opens existing file for reading list of target names
Const INPUT_FILE_NAME = "C:\users.txt"
Const FOR_READING = 1
'Opens file and reads all data in file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
strNames = objFile.ReadAll
objFile.Close
'Separates file by carriage return/line feed
strNTName = Split(strNames, vbCrLf)
' 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 3, strDNSDomain
objTrans.Set 1, strDNSDomain
strNetBIOSDomain = objTrans.Get(3)
' 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.
For Each strName In strNTName
objTrans.Init 1, strNetBIOSDomain
objTrans.Set 3, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(1)
objTextFile.WriteLine "User DN: " & strUserDN
Next
objTextFile.Close
+++++++++++++++++++++++++
Any ideas?
Thanks. Tag: Write back to AD script. Tag: 181738
error sending mail
Hello.
I have a following code:
=============================================
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "subject"
objMessage.Sender = "email@adres.com"
objMessage.To = "email@adres.com"
objMessage.TextBody = "BODY"
'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.server.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
======================================================
The code used to work. But now I get error message "The transport
failed to connect to server"
code: 80040213
source: cdo.message.1
Can somebody point me in direction to solve this?
Thanks
Martin Tag: Write back to AD script. Tag: 181734
InstanceModificationEvent not working
Hi,
I am tryin to figure out why my script isn't working. The script should
notify me when a file changes. However, it only notifies me about Creation or
Deletion events. I am running XP. Has anyone an idea?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""C:\\\\Scripts""'")
Do While True
Set objEventObject = colMonitoredEvents.NextEvent()
Select Case objEventObject.Path_.Class
Case "__InstanceCreationEvent"
WScript.Echo "A new file was just created: " & _
objEventObject.TargetInstance.PartComponent
Case "__InstanceDeletionEvent"
Wscript.Echo "A file was just deleted: " & _
objEventObject.TargetInstance.PartComponent
Case "__InstanceModificationEvent"
Wscript.Echo "A file was just modified: " & _
objEventObject.TargetInstance.PartComponent
End Select
Loop Tag: Write back to AD script. Tag: 181730
bolding text in email output
I am using vbscript to generate SMTP emails. I define the To, From,
Subject and body of the email with variables.
I then set the message variables:
With iMsg
Set .Configuration = iConf
.To = SMTPAddressTo
.From = SMTPAddressFrom
.Subject = Subject
.TextBody = Body
End With
In the body of the email I need some of the text to be bolded or
underlined. I can't figure out how to make this happen. I've tried to
use <b> and </b> but it's not working.
So, if I have something along the lines of the following, and want to
bold the word "must", how would I do it?
Body = "All children must do their homework"
Thanks, Tag: Write back to AD script. Tag: 181727
Enumerating network shares
Hey all,
I need to write a simple script that will enumerate all of the shares
on our file servers, and the number of user accounts with permissions
to each share. The purpose is to evaluate which shares can be deleted
to free up disk space by deleting shares with fewer than 10 users.
I have found some simple VBScript and JScript code that will enumerate
all of the shares on a given server like so:
' Begin code snippit
set objFs = GetObject("WinNT://" & strServer &
"/LanmanServer,FileService")
For Each objShare In objFs
strList = strList & vbCr & LCase(objShare.name) & vbTab &
UCase(objShare.Description)
Next
' End code snippit
My problem is that I need to know what other class members/methods are
available for the "FileService" (instanced as objFs) In the example
above, we use objShare.name and objShare.Description during the loop.
In which documentation would I find a list of the other class
methods/variables for objShare? I am at wits end, just trying to find
the documentation
Thanks in advance
Tim Tag: Write back to AD script. Tag: 181725
Issues with Scripting.FileSystemObject
Hi,
I'm using the above function to capture an image on a regular basis and
I am having some problems. The piece of code in question is designed to
capture an image and save it to a specified location. It as run as a
scheduled task so that it is captured at defined intervals.
The code in question runs perfectly on all Windows XP machines that I
have tried, but does not function as it should on my server running
Windows Server 2003 Web Edt. Where the code comes unstuck on
WinServ2003 is when it goes to converting the binary data it obtained
from accessing the image to text and writing it to the file.
The code in question looks like this:
<code>
Dim Inet, strHTML
strHTML = "http://URL" & "/filename.ext"
BinarySaveURL strHTML, "C:\filename.ext"
Function GetHTTPFile(File)
Dim DLText
Set DLText = CreateObject("WinHttp.WinHttpRequest.5.1")
DLText.Open "GET", File, True
DLText.Send
If DLText.WaitForResponse(5) = True Then
GetHTTPFile = BinToStr(DLText.ResponseBody)
End If
end function
Function BinToStr(Binary)
Dim I
Dim StrOut
For I = 1 To LenB(Binary)
StrOut = StrOut & Chr(AscB(MidB(Binary, I, 1)))
Next
BinToStr = StrOut
End Function
Sub BinarySaveURL(URL, fn)
'Create an Http object, use any of the four objects
Dim Http
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
'Send request To URL
Http.Open "GET", strHTML, False
Http.SetCredentials "username", "password", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
Http.Send
'Get response data As a string
ss = Http.ResponseBody
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
'Create text stream object
Dim TextStream
Set TextStream = FS.CreateTextFile(fn)
'Convert binary data To text And write them To the file
TextStream.Write BinToStr(ss)
End Sub
</code>
It should be noted that WinServ2003 is creating the file in question,
but writes no data to it.
Can anyone explain why this piece of code will run perfectly on WinXP
and not WinServ 2003, and what might need to be done either within the
code or on the server in question to allow this to work. All and any
help/insight appreciated.
Kind Regards,
Michael Harris Tag: Write back to AD script. Tag: 181723
Check WMI Connectivity
This is a multi-part message in MIME format.
------=_NextPart_000_01FA_01C5CB4A.58582FC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I want to check WMI Connection to all PCs in my domain. Script code is =
as following:
For Each strComputer in arrComputers
Set objWMIService =3D GetObject("winmgmts:\\" & strComputer =
&"\root\cimv2") '(*)
If Err.Number > 0 Then
WScript.Echo strComputer & " - Unable to connect to WMI. Error " =
& Err.Number & "-" & Err.Description
Err.Clear
Else
WScript.Echo strComputer & "Connect to WMI: OK!"
End If
Next
WMI, DCOM, COM+ services are running well in all PCs. Domain Group =
Policy forces Windows Firewall in all PCs to open port 135 & 445.
There're times that WMI Connection to some PCs cannot be successful =
because Domain Group Policy are not applied at the PCs. So when the =
script runs, it stops at line (*) about 1 hour (If you choose Properties =
at WMI Control in Computer Management, you will have to wait a long =
time).
This issue occurs in all Wins XP SP2 & Wins 2K SP4.
This issue can be solved by running command "gpupdate /force" OR =
"secedit /refreshpolicy ..."
I want to decrease time to wait PCs' WMI unconnectable. I want to know =
whether a PC is connectable or not immediately. There is any way?
Thanks
------=_NextPart_000_01FA_01C5CB4A.58582FC0
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.2900.2722" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I want to check WMI Connection to all =
PCs in my=20
domain. Script code is as following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>For Each strComputer in =
arrComputers</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2> Set =
objWMIService=20
=3D GetObject("winmgmts:\\" & strComputer &"\root\cimv2")=20
'<STRONG>(*)</STRONG></FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2> If =
Err.Number >=20
0 Then<BR> WScript.Echo strComputer =
& "=20
- Unable to connect to WMI. Error " & Err.Number & "-" =
&=20
Err.Description<BR> =20
Err.Clear<BR> Else<BR> =
=20
WScript.Echo strComputer & "Connect to WMI: =
OK!"<BR> End=20
If</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>Next</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>WMI, DCOM, COM+ services =
are running well=20
in all PCs. Domain Group Policy forces Windows Firewall in all PCs to =
open port=20
135 & 445.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>There're times that WMI Connection =
to some PCs=20
cannot be successful because Domain Group Policy are not applied at the =
PCs. So=20
when the script runs, it stops at line (*) about 1 hour (If you choose=20
Properties at WMI Control in Computer Management, you will have to wait=20
a long time).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This issue occurs in all Wins XP SP2 =
& Wins 2K=20
SP4.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This issue can be solved by running =
command=20
"gpupdate /force" OR "secedit /refreshpolicy ..."</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I want to decrease time to =
wait PCs' WMI=20
unconnectable. I want to know whether a PC is connectable or =
not=20
immediately. There is any way?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_01FA_01C5CB4A.58582FC0-- Tag: Write back to AD script. Tag: 181722
setting registry permissions
I can use subinacl.exe /keyreg
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
/grant=Administrators=F to change the permissions on my registry but it
does not propagate to the children of the registry key, any ideas how I
can get it to propagate to children? Tag: Write back to AD script. Tag: 181719
Re: Communications Between 2 Sites
"Rafael Chemtob" <rchemtobb@nospam.yahoo.com> wrote in message
news:uh79V6qyFHA.3256@TK2MSFTNGP09.phx.gbl...
> Hi,
> i need to be able to have 2 sites communicate together. Here are the
details
> of how it works:
> 2 Domain names:
> www.abc.com
> www.def.com
> 1. The user is in www.abc.com and receives a cookie. the value in the
> cookie is unique.
> 2. On www.abc.com, there is a file called "return.asp"
> (http://www.abc.com/return.asp) which receives 2 parameters.
> a. MID
> b. CID
> 3. The user clicks on a link to go to www.def.com.
> 4. Once the user is on www.def.com and navigates to a certain page that
> contains an MID parameter and a CID parameter. The user would remain at
the
> www.def.com but it needs to communicate to the www.abc.com the MID and
CID.
>
> I've tried different things like placing a 1 pixel image on the
www.def.com
> site (<img src="http://www.abc.com/return.asp?MID=123&CID=456" width=1
> height=1> and that doesn't work.
> Any ideas?
> please advise.
> rafael
>
>
Can't you just pass the values in the QueryString?
That is,
http://www.def.com/your_link.asp?MID=123&CID=456
Then have "your_link.asp" access them via
Request.QueryString("MID")
and
Request.QueryString("CID")
*********************************
i am passing it in the query string. The user will continue to stay in the
www.def.com site so how will the browser know to load the page from the
www.abc.com page? Tag: Write back to AD script. Tag: 181717
Communications between 2 sites
Hi,
i need to be able to have 2 sites communicate together. Here are the details
of how it works:
2 Domain names:
www.abc.com
www.def.com
1. The user is in www.abc.com and receives a cookie. the value in the
cookie is unique.
2. On www.abc.com, there is a file called "return.asp"
(http://www.abc.com/return.asp) which receives 2 parameters.
a. MID
b. CID
3. The user clicks on a link to go to www.def.com.
4. Once the user is on www.def.com and navigates to a certain page that
contains an MID parameter and a CID parameter. The user would remain at the
www.def.com but it needs to communicate to the www.abc.com the MID and CID.
I've tried different things like placing a 1 pixel image on the www.def.com
site (<img src="http://www.abc.com/return.asp?MID=123&CID=456" width=1
height=1> and that doesn't work.
Any ideas?
please advise.
rafael Tag: Write back to AD script. Tag: 181715
clickable span lacks visual queue that i did something! please help
Hi all. Hope this question generates more help than the last one did! I
have a clickable span that runs a script and it workds fine except for
one thing. When a user clicks it, there is no visual queue that the
script is running. So the user ends up clicking it multiple times! I
added a message to the beginning of the script routine, but lag between
the click and then that message pop is just enough to tempt people to
click again. Is there some way to lick this problem? Heres the span and
script:
# span #
<span id="ClickableSpan5" onClick="RunScriptA" ><img border="0"
src="application_profiles/HelperFiles/mag_glass2.jpg" width="34"
height="34"></font><font face="Arial" color="#808080" size="1">
<b> [search]</b></font></span>
# script #
<script>
Sub RunScriptA
document.body.style.cursor = "wait"
on error resume next
set oShellc = CreateObject("Wscript.Shell")
oShellc.run "search_applet.vbs"
document.body.style.cursor = "default"
set oShellc = Nothing
end sub
</script> Tag: Write back to AD script. Tag: 181702
Automate IE Checkbox
Here is the situation: I am logging on to an intranet website that has
5 or 6 checkboxes. I want to be able to go to the same site, but
automatically check these 5 boxes. I don't need to do an automatic
submit or anything. Just need to log on to this intranet website and
already have the 5 boxes checked. I do not have access to the source
code of this intranet site. So, I need to write a script or something
on my computer that will log on to the site but then automatically
check the 5 boxes. Any help on this matter would be appreciated.
Thank-you. Tag: Write back to AD script. Tag: 181700
Adds printer but no with drivers...
I use a simple script to map our printers as shown below.
Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\server1\printer1"
net.SetDefaultPrinter "\\server1\printer1"
The problem is that the printer is added but with no drivers. When you try
to view the properties
or print something you recieve an error saying that no drivers were
installed. Could someone
please help me with a script that adds the correct drivers at the same
time...
Thanks Tag: Write back to AD script. Tag: 181696
Adding a second smtp address
Hi, I need add a secondary smt addres to all users. Must be they login + my
mail domain.
How could I do that in vbs for all users ?
Tnks Tag: Write back to AD script. Tag: 181695
adding multiple users from text file to a group
Hi there,
I am trying to add multiple users accounts from text file and add them to a
group.
I am able to read user list from text file and create new users but not able
to add them into particular group.
What is do is, I open and read the text file and put values in a variable.
Like this
strList = objDirctionary.Item(objItem)
I am able to print strList
But when I use this command to add, I have an error msg saying "server
refuse to process".
objGroup.PutEx ADS_PROPERTY_APPEND, "member", _
Array("cn=" & strList & strDN)
strDN is another variable for AD path, I tried to put actual path but still
does not work.
I guess some problem with "Array" and variable.
please help.
Thanks Tag: Write back to AD script. Tag: 181693
How To Tell If Running CScript or WScript?
I have a VB Script in which I only want to display certain messages if I'm
running under CScript. I use WScript.Echo to display these messages. If the
script is running under WScript, it opens the message box and I have to hit
"OK" to continue, so if the script is running under WScript, I do not want to
display these messages.
I'm looking for a way, in the script, to tell if it is running under CScript
or WScript. Is there some property that tells me which program the script is
running under? If not, is there any other way to accomplish this?
Thanks Tag: Write back to AD script. Tag: 181689
How to read data from SQL db and write to a OWC component
I want to create a Excel OWC component and read data from the Orders
table of the Northwind database and write into the OWC (Office Web
Component) component from VBScript on a ASP page.
Can you kindly share the code.
Thanks
Karen Tag: Write back to AD script. Tag: 181688
Best Expired domain finder
Find expired domains with the best software:
http://www.antssoft.com
The best domain names are already taken. But with expired domain software you can find the best domain names like:
--------------------------------
http://www.beyx.com
http://www.c6d.de
http://www.fyq.us
http://www.gv0.net
http://www.j1o.de
http://www.aj0.net
http://www.3tt.de
http://www.3ss.de
http://www.aryh.com
http://www.qym.us
http://www.f6x.de
http://www.60n.de
http://www.7ix.de
http://www.k9m.de
http://www.4bx.de
http://www.9kk.de
http://www.bx0.net
http://www.0ol.de
http://www.w6x.de
http://www.xub.us
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =--- Tag: Write back to AD script. Tag: 181685
How to close file from vbs?
I know there must be a simple way to do this but so far I haven't found it.
I have a vbs file that writes output to an Excel file. All I want to do is
have the script close the file if it is open when the script is run.
Something like:
If test.xls is open
Close test.xls
Is this possible? Tag: Write back to AD script. Tag: 181678
Create network neighborhood shortcuts depending on Group membership
I want to map drives without a drive letter in Network places. I have
the two parts (removing and adding shortcuts in nethood, but cannot get
the rights checker to work with them. Take a look at what I have...
' Clear all entries in the nethood folder
Const NETHOOD = &H13&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path & "\*.*"
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(strPath)
*******
' create nethood shortcuts
Const NETHOOD = &H13&
Set objWSHShell = CreateObject("Wscript.Shell")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self
strNetHood = objFolderItem.Path
strShortcutName = "Test Folder"
strShortcutPath = "\\testserver\p15141"
Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save
What I WANT to do is associate these with group
permissions. I need to create about 300 shortcuts for projects,
departments, proposals and so on. Groups are nested and in a w2k3
domain.The clients are w2k and XP. The share names are \\server1\share1
standard shares on w2k and w2k3 servers.
Thanks in advance, Tag: Write back to AD script. Tag: 181673
PasteSpecial: values and formats possible in vbs?
I use the following code in vbs to copy and paste data from one Excel cell
to another:
XLBook.Worksheets("Sheet1").Select
XLBook.Worksheets("Sheet1").Range("A1").Copy
XLBook.Worksheets("Sheet1").Range("B1").PasteSpecial
My code above does a regular paste, but I need to do a paste special that
only pastes values and number formats. I've created a macro in Excel that
does this and the vba code for it is:
Range("A1").Select
Selection.Copy
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
However, the vba code above does not work in vbs. It throws an Expceted
Statement error at the first colon (:) in the PasteSpecial line. Does anyone
know how I can do this in vbs? Tag: Write back to AD script. Tag: 181666
server.HTMLEncode Corrupts French Characters
Hello there,
I'm using server.HTMLEncode and I find that it corrupts the characters.
I added this to my page and it didn't work:
<meta http-equiv"Content-Type" content"text/html; charset=utf-8"/>
I tried it under Windows Server 2000 and Windows Server 2003, both failed.
How can I get HTMLEncode to work with the French Characters?
I will be much appreciated for the help.
Thank.
Kat Tag: Write back to AD script. Tag: 181661
Save outlook messages as textfiles
I receive a forward email with several other emails as attachments.
I have a .vbs script that saves the e-mail to disk including the
attachments (several e-mails) in the mail. I would like to save the
mail like readable .txt files instead of the default .msg files.
I'm using the SaveAsFile propertie, but i'm not able to save the
attached .msg mails as plain text files.
if you have some vbs lines that could help me, that would be very nice
thanx
Leon Tag: Write back to AD script. Tag: 181652
Excel Graph
I'm creating a jpg from a comma seperated input file.
The file is in the style
A,10,20
B,30,50
C1,21,40
C2,35,70
E,36,50
So has three values and is alphabetically listed with the first.
I'm creating the Excel graph with the following script
=================================================
DIM x(100)
DIM y(100)
DIM z(100)
vDate=Date()
LastMonth=DateAdd("m",-1,vDate)
vYear=Year(LastMonth)
vMonth1=Month(LastMonth)
vMonth=MonthName(vMonth1)
If vMonth1<10 then vMonth1="0"&vMonth1
Set oFS=CreateObject("Scripting.FileSystemObject")
inFILE="data.txt"
Set inputFILE=oFS.OpenTextFile(inFILE)
linecount=0
While Not inputFILE.AtEndOfStream
linecount=linecount+1
vline = inputFILE.Readline
If Len(vline)>0 then
splitline=split(vline,",")
x(linecount)=splitline(0)
y(linecount)=splitline(1)
z(linecount)=splitline(2)
End If
WEnd
inputFILE.Close
Set inputFILE=Nothing
Set oFS=Nothing
set loChartSpace = WScript.CreateObject("OWC10.ChartSpace")
set oConst = loChartSpace.Constants
set loGraph = loChartSpace.Charts.Add()
loGraph.Type = 3
loGraph.HasLegend = True
loGraph.PlotArea.Interior.Color = "azure"
loChartSpace.HasChartSpaceTitle = True
loChartSpace.ChartSpaceTitle.Caption = "Values - "& vMonth & ", "&vYear
loChartSpace.ChartSpaceTitle.Font.Bold = True
Set objAxis = loGraph.Axes(oConst.chAxisPositionBottom)
'Axis Properties
With objAxis
.HasTitle = True
.Scaling.Maximum=100
.Title.Caption = "Percent"
.Font.Size = 6
End With
Set objAxis = loGraph.Axes(oConst.chAxisPositionLeft)
'Axis Properties
With objAxis
.HasTitle = True
'.Scaling.Maximum=100
.Title.Caption = "Values"
.Font.Size = 8
End With
loGraph.SeriesCollection.Add()
loGraph.SeriesCollection(0).Caption = "In"
loGraph.SeriesCollection(0).Interior.Color = "#66ccff"
loGraph.SeriesCollection(0).SetData oConst.chDimCategories,
oConst.chDataLiteral, x
loGraph.SeriesCollection(0).SetData oConst.chDimValues,
oConst.chDataLiteral, y
loGraph.SeriesCollection.Add()
loGraph.SeriesCollection(1).Caption = "Out"
loGraph.SeriesCollection(1).Interior.Color = "#000099"
loGraph.SeriesCollection(1).SetData oConst.chDimValues,
oConst.chDataLiteral, z
lcFile = "D:\rank\graphs\"&vYear&vMonth1&".jpg"
loChartSpace.ExportPicture lcFile,"jpg",800,600
=========================================================
Most of which has been found on the internet (so if you see some of your own
code in there - thanks!!!!!!!)
The thing is I'm setting loGraph.Type = 3 which is sideways columns.
The problem I'v got is that the values in the first column of the csv
(alphabetical) are displayed in reverse (top to bottom) on the graph.
So the graph show in the left column :
E
C2
C1
B
A
It seems to be OK if I choose loGraph.Type = 0 (columns going up) with the
bottom axis showing A,B,C1,C2,E
Is there any way I can flip the data simply so when I've got loGraph.Type =
3 the left axis is alphabetically downwards?
Many Thanks Tag: Write back to AD script. Tag: 181650
Daily backup
Hi everyone
I have XP Pro SP2 and would like to schedule an automatic backup of the "My
Documents" folder to a USB memory stick (in effect, it's my G: drive when I
check via Windows Explorer). I have a memory stick inserted throughout the
day. When the copy of the whole folder occurs, I'd like to have it named as
<Day, date at time> (taken from the computer's current time settings) such
as "Wednesday, 5 October 2005 at 0927". I've searched for scripts to do
such a copy but, as my knowledge of scripts is negligible, I need guidance.
I'd envisage running the script via Scheduler but can this all be done? Is
it a good idea? Can someone give me a nudge to start this project?
Thanks for your time and patience. Tag: Write back to AD script. Tag: 181649
AD user parameters
Hi there
When I create a user in AD via a script I can tell his (her) firstname,
lastname, username etc
I want to add his (her) email adress, description, office.
What's the name of the fields? or where can I find them?
Thanks
Phil Tag: Write back to AD script. Tag: 181648
Export and import DHCP configuration
Hi there
I need to backup my dhcp datas to be able either to reload them in case
of problem on my DHCP service or to load them on another DHCP server in
case of crash of my DHCP server.
I'd like to record the datas in a text file to be able to modify it
easily (In case of crash I'll need to change the range of my dynamic IP
adresses).
Thanks in advance
Phil Tag: Write back to AD script. Tag: 181647
HTA Minimize IE window method ??
I've searched high and low without success for a HTA method that will
Minimize and then Maximize the active HTA window.
Can someone point me to a URL or detail how to perform this task? Tag: Write back to AD script. Tag: 181646
Creating a shortcut icon in All users start menu?
Hi.
I would like to add a few icons to the "All users" start menu using a
VBScript.
Are there any examples i can have a look at.
What i especially need is to know.
1.
How can i find out the correct path to X:\document and settings\All
users\Start menu\ using some variable?
2.
how do i create and place a shortcut in the start menu?
thanks in advance
k Tag: Write back to AD script. Tag: 181645
Enable DNS Server automatically
Hi Group
I want to Write a script to automatic enbale the "DNS Server Address" and
enter a fixed server IP as "172.18.2.1"
Please help me for this.
Regards
Kathy Tag: Write back to AD script. Tag: 181644
Script to Update Driver
Hi Group
I want to Write a script to Update the driver of keyboard.
Right now I am doing it manually by going in control panel and selecting
the keyboard, right click and cliking on the "Update driver" option fron the
specefic location.
I want to do it automatically, Can anyone help me for this.
Thanks and Regards
Kathy Tag: Write back to AD script. Tag: 181643
Need Help getting PC data into a file
Hi There
I am very very very new to scripting. If any one can guide me in the
right direction I will really really appreciate.
I am building a sql data base of my computers at work (about 1000) of
them.
I was wondering if I can write a batch file, which will get me the
following info into a text file
Ram
MAC
HD size
Proc speed
Does nay one know how?
THx a lot Tag: Write back to AD script. Tag: 181638
Script bombs if user not member of any groups
I have a script that deletes a specific group from user accounts. It works
(deletes the group, if present) as long as the user account is a member of
any other group besides Domain Users. The script bombs if the user not member
of any group (other than Domain Users) at this line:
arrMemberOf = ouser.GetEx("memberOf")
The error is:
Active Directory: The directory property cannot be found in the cache.
How can I get my script to finish? Tag: Write back to AD script. Tag: 181635
Unable to register vbscript.dll
I attempt to register vbscript.dll using regsvr32 but I'm unable to. I get
the error DllRegisterServer failed. Is there any solution to get around
this? Tag: Write back to AD script. Tag: 181634
I'm unable to register vb or jscript.dll
I cannot use regsvr32 in a Windows XP Home environment to register said .dll
files. The unit I'm working on currently has multiple spyware infections.
Without being able to register these files I'm unable to install certain
spyware programs. Any ideas as to why this is happening? I tried to
reinstall Windows Scripting 5.6 to no avail. Tag: Write back to AD script. Tag: 181631
Unable to add a Variable to a SELECT statement
Hi, I'm learning VBScript by actually writing "proof of concept" code for
work. One VBScript piece has my head being driven mad. It must be simple
but I can't find any code on the web (I might be looking in the wrong
place). Staff save work files and folders to an individual folder on a
server - this needs deleting every so often.
Eventually I will connect this code with an excel spreadsheet and loop
through possibly hundreds of folders and contents to be deleted. The
problem is how to add the variable: "strDelete" to the SELECT part of the
statement (assuming I have got that peice of code right?)
Here's what I have so far.
========================================================================
On Error Resume Next
dim strComputer, strStaff, strOffice, strDelete
strComputer = InputBox("Please enter a workstation number")
strOffice = InputBox("Please enter a staff number")
strStaff = InputBox("Please enter a staff number")
strDelete = "\\" & strComputer & "\e$\data\" & strOffice & "\users\" &
strStaff
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery ("SELECT * FROM Win32_Directory _
WHERE Name = 'strDelete' ")
For Each objFolder in colFolders
errResults = objFolder.Delete
Wscript.Echo errResults
Next
' example of path: \\<strServer>\e$\data\<strOffice>\users\<strStaff>
' real example: \\london01\e$\data\OxfordRoad\users\MatthewsFolder
=========================================================================
TIA
James Tee Tag: Write back to AD script. Tag: 181627
Excel AddIns.Add problem
Hi! :-)
I've made a installation script for a templates package we use. It includes
a .xla file (= an Excel Add-In).
When I started testing the script on the rest of the It dept two (of 20+)
got an error. Not in my script but in the .xla code:
I install the add-in with:
If objFileSystem.FileExists(strFileName) Then
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
Dim objAddIn : Set objAddin = objExcel.AddIns.Add(strFileName,True)
objAddIn.Installed = True
On Error Resume Next
Dim objAddInWorkbook : Set objAddInWorkbook =
objExcel.Workbooks(objExcel.AddIns(objAddIn.Name))
If Err <> 0 Then Set objAddInWorkbook =
objExcel.Workbooks.Open(objAddIn.FullName)
On Error Goto 0
objExcel.Quit
End If
The error seemes to occur in Excel when the "Set objAddInWorkbook =
objExcel.Workbooks.Open(objAddIn.FullName)" row is run.
The error message in excel is:
Run-time error '-2147467259 (80004005)':
Metod 'OnAction' of object '_CommandBarButton' failed
I would prefer to solve this problem by changing my script but if it's
easier/possible in the -xla file.
Here's the sub where the problem occurs, it's started from the workbook_open
sub, I don't know if it's also run automatically or not:
Private Sub Load_Menus()
Dim myMenuBar As CommandBar
Dim newMenu As CommandBarControl
Dim ctrl1 As CommandBarButton
Dim ctrl2 As CommandBarButton
Dim ctrl3 As CommandBarButton
Dim ctrl4 As CommandBarButton
Dim mnuMenu As CommandBarControl
Dim mnuMenuItem As Variant
Set myMenuBar = Application.CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup,
Temporary:=True)
newMenu.Caption = "&Leanstream"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)
ctrl1.Caption = "&Spara som nytt dokument i e-pärm"
ctrl1.OnAction = "ThisWorkbook.GetMyProjects"
Set ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)
ctrl2.Caption = "&Checka in och stäng dokumentet"
ctrl2.OnAction = "modCheckIn.CheckaIn"
Set ctrl3 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)
ctrl3.Caption = "&Uppdatera fält i dokumentet"
ctrl3.OnAction = "modDocOpen.DocOpen"
Set ctrl4 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)
ctrl4.Caption = "&Hjälp om Leanstreamfunktioner"
ctrl4.OnAction = "ThisWorkbook.VisaHjalp"
'Knöligt men nödvändigt. Om man använder
Application.CommandBars.FindControl(ID:=748).OnAction =
"ThisWorkbook.LSArkivSparaSom" så funkar det inte!
If Application.CommandBars.FindControl(ID:=748).Caption = "Spara
so&m..." Then
Application.CommandBars("Worksheet Menu
Bar").Controls("&Arkiv").Controls("Spara so&m...").OnAction =
"ThisWorkbook.LSArkivSparaSom"
ElseIf Application.CommandBars.FindControl(ID:=748).Caption = "Save
&As..." Then
Application.CommandBars("Worksheet Menu
Bar").Controls("&File").Controls("Save &As...").OnAction =
"ThisWorkbook.LSArkivSparaSom"
End If
End Sub
The row Excel marks yellow is "ctrl1.OnAction =
"ThisWorkbook.GetMyProjects"".
I solved the proplem on one of the machines by adding the .xla manually.
Though the whole point of this is not to have to do things manually so any
input's welcome!! :-)
Thanks a million! :-)
/Sofia Tag: Write back to AD script. Tag: 181623
Cluster Monitoring
Has anyone come across a script to monitor cluster wmi events to per4form
notification when a cluster failsover?
Paul Tag: Write back to AD script. Tag: 181621
Replace / with , in a text file
I need to open every *.log file in a folder and replace all occurances of
"/" with a "," inside a text file. Each .log file probably has 2000 lines.
I am officially lost.
Is there a simple solution for this? Any ideas where I can info on how to do
this?
Thanks
Steve Tag: Write back to AD script. Tag: 181618
retreive contents of add/remove programs
Hi,
Is there a sample script that I could run over a large network reporting
what is registered in add/remove programs on each workstation? Perhaps via
a GPO?
TIA Tag: Write back to AD script. Tag: 181615
How to create a self extracting zip file that starts excel with a macro
I have created a pivot report against a .CSV data file.
Everymonth I want to email the combination of the CSV file and the
Excel pivot report to our users. So once the user clicks on the zip
file it must save the CSV file in say c:\temp and then save the Excel
pivot report as well in c:\temp and the Excel workbook pivot report
start against the file in C:\temp
Please help with code how I can do this.
Thanks
Karen Tag: Write back to AD script. Tag: 181611
Copying Folders by Using the Shell Folder Object
Hello
I am copying folders like:
objFolder.CopyHere "C:\Scripts", &H100&
I want to pass more than one argument, e.g &H100& and &H4&.
How do I do that?
Thanks in advance
/Svensson Tag: Write back to AD script. Tag: 181607
Is there a script that will display Full Users name and Telephone number and
ask user to change the number if not correct and write back to AD.