uninstalling software
Hi,
anybody has a script to uninstall an application such as winzip on 100
computers remotely from my computer?
thanks Tag: registerring ocx and dll files Tag: 179264
Has anyone played with this script? http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/default.mspx#EKAA
Has anyone played with this script?
http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/default.mspx#EKAA
It works really well but I don't like the approach. This approach
requires the administrator to maintain a list of exe's which are known
spyware. There are several problems with this approach.
For example (From Symantec.com)
When Spyware.Perfect installer is executed, it performs the following
actions:
1. Creates the following files:
" [FILE NAME].exe
" [FILE NAME]r.exe
" [FILE NAME]un.exe
" [FILE NAME]vw.exe
" [FILE NAME]hk.dll
" [FILE NAME]i.dll
" [FILE NAME]wb.dll
Since we don't know the value of [FILE NAME], we wouldn't be able to
add this to the list unless we could use the old DOS wildcards like
????????r.exe and such. We would still need to know how long "FILE
NAME" is to apply the appropriate number of ??????'s.
Also, new strains of spyware will slip through the cracks unless the
list is updated and there doesn't seem to be a good single source to
check.
So, why wouldn't it be possible to create a "white list" of known
services and processes which should be mostly static (only upgrades
and such would need to force a revision) and ONLY allow those
processes to run. For me to do it I would need a list of processes
from Microsoft or do the inventory myself, then add in the exe's of
the processes I know I will need from Symantec, Scansoft, Adobe, etc.
The white list could also be secured with Software restriction
policies in Windows which would prevent malicious code from taking on
the name of known Windows services which is another weak point of the
current script's approach.
I don't know too much about scripting (I barely know how to cut and
paste code to get it to work) but would the logic need to be changed a
lot to make this idea work? Is there a down-side I am not thinking
of?
I believe Windows can be secured to the point where you would never
need an anti-spyware product or even a script like this one. If I was
building a new network from the ground-up, I would set things up this
way. It would only take careful selection of software which does not
require admin rights on machines (something my current migration to a
secured environment is lacking until I flush out programs like Adobe
Capture and QuickBooks 2005). The recent flack over the status of
Claria and Microsoft really opened my eyes about this because I want
to maintain control over my stuff. Adding anti-spyware to the mix to
try and do my job for me isn't going to get the job done is we are
arguing over what is spyware and what is not. EULA or not, I don't
want certain programs running in my organization. This includes
freecell.exe and sol.exe and anything Claria/Gator related.
Mike Tag: registerring ocx and dll files Tag: 179261
How to create an array in ASP/VBScript in this specific case?
I want to replace Response.Write in the code below with a an array type
variable but I am not sure how:
for each element in request.form
response.write(element & ": " & request.form(element) &"<br>")
next
Obviously, this does not work as it only sets the last value to the
variable:
for each element in request.form
str_val = element & ": " & request.form(element) &"<br>"
next
Is there some way to set the whole array to the str_val variable?
Thanks,
J.S.
-- Tag: registerring ocx and dll files Tag: 179247
ASP/VBScript: How to suppress the submit button from the results of this code?
I use the following code to obtain the names and values of all the submitted
form elements in an ASP page:
for each element in Request.Form
Response.Write(element & ": " & Request.Form(element) &"<br>")
next
However, it also gives me the name and value of the Submit button. Is there
any way I can suppress that from my results?
Thanks,
J.S.
-- Tag: registerring ocx and dll files Tag: 179245
Need to exit loop early
Hopefully this is a straight forward question.
I have a script that reads a file one line at a time, and carries out
ceratin actions depending on what it reads on each line. The script uses a
Do Until....Loop, using
Do Until objTextFile.AtEndOfStream
Loop
I need to add error checking, so that if a set action to be carried out by
the script has an err.number <> 0, the loop will ignore the rest of the loop,
and continue to the next line of the text file that it is reading. So, what
I need to the command to end one "loop" early, but continue through remaining
loops. I'm sure it should be really simple, but I don't seem to be able to
get the syntax right. Tag: registerring ocx and dll files Tag: 179244
Call a function create in dotnet
Hello,
I create a function in dotnet.
How can I call it in a Html page ? Tag: registerring ocx and dll files Tag: 179240
Credentials
When running 'mofcomp abc.mof',
.there is no problem if running by local administrator account.
.error '0x80041003' in %windir%\system32\wbemlogs\wbemess.log if running
by domain accounts (that are member of local administrators group).
Help me! Tag: registerring ocx and dll files Tag: 179234
Close HTA
I have created an HTA with VBS to perform various tasks.
What command will permit me to close the active HTA?
Thanks,
Danie Tag: registerring ocx and dll files Tag: 179232
updating registry
Hello,
How can I create a script to go through the registry and replace an entry
with another. Can this be done on remote computer or is it limited to local
computers only.
I would like to replace \\serve01\sw$ with \\serve03\sw$ and this would need
to include any entry with it subdirectories \\serve01\sw$\... with
\\serve03\sw$\...
Thanking you in advance for your assistance!
Daniel Tag: registerring ocx and dll files Tag: 179230
Insert image to Excel programmatically
Hi experts,
I wish to insert JPEG files into the Excel document through programming way.
Is VBScript able to help me achieve my objective? Please advice
Thanks a lot!!! Tag: registerring ocx and dll files Tag: 179228
Configure SNMP Settings
I've been looking all over. Can someone please email me a script to
configure all the community, traps destations ect for SNMP
Thanks
--
--
Ryan McKay
Calgary, Alberta, Canada
--
Email: avengerdx@hotmail.com
-- Tag: registerring ocx and dll files Tag: 179224
Reading screen width and height
I lifted this bit of code (modified) from the Scripting Center:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor")
For Each objItem in colItems
ScreenHeight=objItem.ScreenHeight
ScreenWidth=objItem.ScreenWidth
Next
It works fine, but is there a simpler way to do it, without the loop and array?
I only have one monitor.
Dave Tag: registerring ocx and dll files Tag: 179223
HELP - Deleting and Access database Record
I have a page that list all records in an access table. I would like to add
a delete record function to the list to delete selected records. Here is my
current code:
*********************************************************
<%
Dim strDB, con
Dim rs
strDB = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("ques_comm.mdb") & ";"
Set con = CreateObject("ADODB.Connection")
con.Open strDB
Set rs = CreateObject("ADODB.Recordset")
rs.CursorLocation =3
rs.Open "select * from questions ORDER BY usernumber DESC", con
WHILE NOT rs.EOF %>
<TR>
<TD width=25 rowspan="3" align=left valign="middle"
bgColor=#000000><div align="center"><span
class="style1"><%=rs("usernumber")%> </span></div></td>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Name:</font></strong></td>
<td width="697" bgColor=#e7e7de><font
size="2"><%=rs("UserName")%> </font></td> <td width="3"></TD>
</TR>
<TR>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Time
Submitted:</font></strong></td>
<td bgColor=#e7e7de><font
size="2"><%=rs("SubmitDT")%> <%=rs("SubmitTF")%> </font></TD>
</TR>
<TR>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Question:</font></strong></td>
<td bgColor=#e7e7de><font size="2"><%=rs("Comments")%> </font></TD>
</TR>
<TR>
<TD align=left colspn=2> </TD>
<TD align=left height=25 colspn=2> </TD>
</TR>
<% rs.MoveNext
wend
con.Close
Set con = Nothing
Set rs = Nothing
%>
********************************************************
Thanks in advance.
Rich Tag: registerring ocx and dll files Tag: 179222
Change local password
I want to change a password of a specific user on my computer by using
VBScript.
I just start using this language and i need a little help. I found a
lot of script to change password but in a Ldap environnement. Tag: registerring ocx and dll files Tag: 179220
Regular expression help
Need to parse through our code files and find every instance of other
files referenced, looking for included files, images, etc. The
expression I'm using is
("|')(.*)(\.asp|\.htm(l)?|\.gif|\.jpg)("|')
Which works great.
Now what I need to do and can't figure out is how to exclude certain
matches, as in
<!--#include file="../../myincludefiles/sqlConnection.asp"-->
<a href="http://www.ourserver.com/somebranchfile.asp">
I don't want anything (for instance) that includes the strings
'myincludefiles' or 'http' inside the quotes.
I'd appreciate any help I can get on this.
- Wm Tag: registerring ocx and dll files Tag: 179219
Learning scripting vbs
Hi to everyone:
I'm a beginer in the scripting in vbs, and I want to learn it, as full as it
can be learned, but I don't know where i can begin.
which or what page can i visit to learn this script languaje?
Thank you....
Baruch Ortiz Tag: registerring ocx and dll files Tag: 179217
error: can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus
Hi,
I am getting the message below when i try to disable a select/list box
using vbscript, client side programming.
error: can't move focus to the control because it is invisible, not
enabled, or of a type that does not accept the focus
This is the code i am using below; I have tried various attempts to get
rid of the error message. The list box does become disabled however the
message strill occurs. Does anyone know how to get around this error
message? Any help much appreciated...
-- code below --
set tr = document.getElementById("table_body").lastchild.previouschild
tr.all.tags("select")("test_list_box").disabled = true Tag: registerring ocx and dll files Tag: 179216
This script shows the Hex dump of a file
Hello,
this script opens an IE windows and shows the hex dump of the file dropped on the icon.
If you do not use drag and drop, you can choose a file from the open dialog box (needs the
appropriate library registered).
Giovanni.
'<%
'************************************************
' File: HexDump2.vbs (VBScript)
' Author: Giovanni Cenati
' 16 june 2005
' Mostra in IE un file in esadecimale
' Shows a hex dump of a selected file
' http://digilander.libero.it
' Codice utilizzabile citando il sito.
' Based on a script post by spmlinton at sk sympatico ca
' in the newsgroup microsoft.public.scripting.vbscript
' on Thu, 27 Mar 2003
'************************************************
Set objArgs = WScript.Arguments 'Vedo se ci sono degli argomenti passati allo script
if objargs.count=0 then
Set comDlg=CreateObject("MSComDlg.CommonDialog.1")
const cdlOFNHideReadOnly = 4 'Nasconde la casella "sola lettura"
const cdlOFNFileMustExist = 4096 'Puoi scegliere solo files esistenti
Const cdlOFNExplorer = 524288 'Finestra in stile win95
comDlg.Flags = cdlOFNHideReadOnly + cdlOFNFileMustExist + cdlOFNExplorer
comDlg.Filter = "Tutti i files|*.*"
comDlg.DialogTitle="Visualizza un file in formato esadecimale"
'comDlg.InitDir="c:\"
comDlg.maxfilesize=500
'comDlg.FileName="c:\autoexec.bat"
comDlg.ShowOpen
if comDlg.FileName="" then wscript.quit
FName= comDlg.FileName
'Ricordo il filename scelto. Saves the filename in variable
set comDlg=nothing 'Scarica l'oggetto. Discards object
else
fName = objArgs(0)
end if
' Lancia Internet Explorer per mostrare i risultati.
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.navigate "about:blank" ' documento vuoto. Empty doc.
' Importante: aspetta che Internet Explorer sia pronto
Do While (oIE.Busy) ' Waits until IE is ready
WScript.Sleep 200 ' Sospende per 200 millisecondi.
Loop
oIE.Visible = 1 ' Internet Explorer è visibile.
oIE.ToolBar = 1 ' ed ha la toolbar così è presente il pulsante "stampa"
Set doc1 = oIE.Document ' Punta al documento...
doc1.open ' ...lo apre
' Scrive le intestazioni html. Writes html headers
doc1.writeln("<html><head><title>" & Title & "</title></head>")
doc1.writeln("<body bgcolor='#FAF0F0'><pre>")
Const ForReading = 1
set fso=createobject("scripting.filesystemobject")
set f=fso.getfile(FName) 'apro il file. Open file for reading
set ts=f.OpenAsTextStream(ForReading,0) 'in lettura
byteCtr=0
chCtr=0
doc1.writeln(Fname)
doc1.writeln(f.size & " bytes")
doc1.writeln()
do while not ts.atendofstream
ch=ts.read(1) 'Legge un carattere. Reads a char
chCtr=chCtr + 1 'E ne tiene nota nel conteggio. Counts it
hexch=hex(asc(ch)) 'Ne determina il codice ascii. Finds ascii code
if len(hexch)< 2 then hexch="0" & hexch
hexLine=hexLine & hexch & " " 'Adds it to the string
if asc(ch)> 31 and asc(ch)< 127 then 'Printable?
if ch=">" then ch=">" '(IE lo interpreterebbe come un tag)
if ch="<" then ch="<" '(IE would think it's a tag)
ascStr=ascStr & ch 'è stampabile. Yes
else
ascStr=ascStr & "." 'non è stampabile. No
end if
'Prepara la stampa di una riga:
'indirizzo - 16 esadecimali - 16 caratteri ascii
'Prepares a line to be displayed:
'Address, 16 hex characters, 16 ascii
if chCtr=16 or ts.atendofstream then
lineStr=byteCtr & vbtab & hexLine & vbtab & ascStr
'Now manages last line if it has less than 16 chars
if chCtr<16 then 'Se l'ultima riga ha meno di 16 cartteri...
lineStr=byteCtr & vbtab & hexLine 'inizio normalmente
for r= (chCtr+1) to 16 'poi riempio la parte restante della riga
lineStr= lineStr & "-- " 'con dei caratteri
next
lineStr = lineStr & vbtab & ascStr 'e finisco normalmente
end if
'Writes output to Internet Explorer
doc1.writeln(lineStr) 'Scrive in IE la riga creata
byteCtr=byteCtr + chCtr 'incrementa l'indirizzo
chCtr=0 'e azzera il parziale
ascStr=""
hexLine=""
end if
loop
'Chiude le intestazioni html
'Closes html headers
doc1.writeln("</pre></body></html>")
doc1.close
set fso=nothing
set f=nothing
set ts=nothing
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (VbScript) Tag: registerring ocx and dll files Tag: 179210
make a program start
I want to create a script which start a program and when someone close it it
will come up again. I want also this program to be maximized.
Someone who can help me with this script? Tag: registerring ocx and dll files Tag: 179205
VBS to set folder permissions
Hunter1,
Please contact me at
brooks.vanhorn@verizon.net,
Thanks,
Brooks
Hunter1 wrote:
> *I do that with VB without any dramas. Initially when we set up an
> automatic account generation system I was familiar with VB bu
> hadn't
> really played around a great deal with VBScript, since then I d
> nearly
> everything in VBScript, but since the VB proggy which creates an
> sets
> the permissions on their personal directories works I've had no nee
> to
> rewrite it. I can wack up the code to do this in VB if you want,
> shouldn't be too hard to port to VBScript.
>
>
> Brooks wrote:
> > Using VBS I need to search the AD on a Win2K server and for eac
> name in
> > an OU, check to see that a personal folder has been setup. If no
> then
> > I need to create the folder on the server and set the permissions
> > correctly. [Note that the VB script will be run on the server.]
> OK,
> > but here is the problem: I need to set the folder permissions s
> that
> > only the administrators group and that person in the AD have full
> > access permissions and nobody else has no access to it. How do
> do it
> > in vbs?
> >
> > Thanks very much for your reply,
> >
> > Brooks
> >
> > Brooks.VanHorn@Verizon.Net
> >
> >
> >
> > --
> > Brooks
>
> ------------------------------------------------------------------------
> > Posted via [url]http://www.codecomments.com[/url]
>
> ------------------------------------------------------------------------
> > * 'Brooks Van Horn' (brooks.vanhorn@verizon.net) 'Brooks
(brooks.vanhorn@verizon.net
-
Brook
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: registerring ocx and dll files Tag: 179193
copy and Past in Tool Bar Addrs IE
Hi
How can I to Build a script in Address tool Bar of the Internet Explorer
?
thank you in advance Tag: registerring ocx and dll files Tag: 179186
Processing paragraphs in a Word document
I've written a lot of VBSCRIPT code but very little of it involves
Microsoft Office documents.
I'm working on a program that will read a bunch of Word documents. I
want to loop through all the paragraphs in a document and search for
various strings and then summarize them in a spreadsheet.
I think I know how to do the spreadsheet part, but I'm at a loss at
how to capture the paragraphs of text. I think I need to create a
collection of paragraphs and then loop through them.
I've spent several days searching through various web sites and all
the examples I've found are quite trivial and don't help. I watched
some Microsoft webcasts but they also didn't go into much detail. All
they seemed to cover was how to put a few lines of text into a new
document.
What I want to do seems quite basic, but I can't find much
documentation on how to get started.
Any examples of code that will create this collection and loop through
it would be appreciated.
Barry Tag: registerring ocx and dll files Tag: 179179
Can't display old help file for Microsoft Script Control
I want to use the Microsoft Script Control MSSCRIPT.OCX which is
automatically registered when Windows XP is installed. I am able to do some
things with the control but I'm having problems, so I'd like to read the
help file MSSCRIPT.HLP, which is not automatically installed by Windows XP.
I've gone to msdn.microsoft.com and downloaded the latest sct10en.exe
installation package for the script control, version 1.0.0.8825. In this
package, the control is dated 8/25/2004, but the help file is dated 5/24/97.
So naturally, WXP doesn't know how to display this old help file. I get the
message: "Cannot find or load the file HLP95EN.DLL. This file should be
copied to D:\WINDOWS/system32 or a directory in your path." My W98SE system
can't display this help file either. WXP partially displays the help file,
some or all of the text, but does not display its graphics.
Can anyone point me in the right direction to get the tools necessary to
display this help file in WXP?
Thanks,
-Paul Randall Tag: registerring ocx and dll files Tag: 179174
search result display
I need a script or reference to allow me to display my search button (in
FrontPage 2003) results to be displayed in a different web page of my web
site rather than the same index page where the search button is located.
Could anyone help me with this ?
--
1a23n456h7890d Tag: registerring ocx and dll files Tag: 179172
I Need Visual Studio.Net Direction Please!
Hello all,
I am somewhat experienced in creating Access forms and would like to learn
how to create applications, and convert my Access applications, in Visual
Studio .net.
Questions:
Where do I go for the most basic getting started info? The help files
return too much info for me right now and I get swamped. Specifically, I
want to click a button on my main form and open a popup form that contains a
listbox. In Access there's a wizard for this. No such luck in VS.net?
This must be very basic, but I can't find mention of it anywhere.
I would appreciate any and all pointers.
TIA,
Jake Tag: registerring ocx and dll files Tag: 179165
How to create a vbs to do the tasks?
1. Check if a hidden file (A.txt) located at "C:\Published"?
2. if YES, copy it to 'My Documents' folder and overwrite the old version
3. Set the A.txt file's property is not hidden.
My question points are how to get the 'My Documents' folder of my login
account on Windows Server 2003 and set the file's property? Tag: registerring ocx and dll files Tag: 179162
HTA Grid Control
I'm working on a HTA application "Interactive SQL" that uses
the "Microsoft Datagrid Control 6.0" (from my VC++ 6.0, I *think*)
to display ADO recordsets. This works well on my W 2000 developer
computer.
I know that I have to expect licence problems when I deploy the HTA
to machines that have no developing system installed. I red about/
downloaded the lpk_tool from Microsoft and generated a .lpk for
msdatgrd.ocx.
(1) Will that .lpk file be valid for (other versions of) msdatgrd.ocx
on Windows XP computers?
(2) Am I entitled to distribute my msdatgrd.ocx (and the .lpk file)
freely, although it will not be used with a VC++ program of
mine?
(3) Is there a comparable grid control (.NET, Windows Forms) included
in a 'standard' installation of Windows XP that can be used from
VBScript? Tag: registerring ocx and dll files Tag: 179156
VBScript Reference Card
Is there a VBSCript reference card (preferably free) floating
around? I have been using:
http://tiger.la.asu.edu/Quick_Ref/vbasic_quickref.pdf
although its actually a Visual Basic reference card and I
just ignore the not relevant portions. Tag: registerring ocx and dll files Tag: 179149
webbrowser control capturing event in framed document
Hi,
I have an applictaion that uses the webbrowser control to handle events
fired in the web page. I gave created a class as explained in the tutorial
at
http://msdn.microsoft.com/workshop/browser/webbrowser/tutorials/forward.asp?frame=true
I have no problem capturing events in a non-framed page but can't seem to
do it in the framed document, this is what i have:
Private Sub brwWebBrowser_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
Set cfForward = New clsForward
cfForward.Set_Destination Me, "Web_Proc"
On Error Resume Next
brwWebBrowser.Document.All.myButton.onclick = cfForward
End Sub
this works fine for capturing the button click on the non-framed page. Now
the next page has a simalar button i wish to capture the onclick event, but
it is in the top frame of the frameset called "topFrame"
I ahve tried
brwWebBrowser.Document.All.topFrame.myButton.onclick = cfForward
but this wont work
any ideas?
THIA
Bill P Tag: registerring ocx and dll files Tag: 179147
How to distribute hotfix using script?
Dear all,
I have posted a question regading distirbuting a hotfix in the Windows
Update discussion newsgroup. Mr. Torgeir Bakken advised me to do that using a
startup script.
The hotfix that I am planning to distribute is the one explaned through
article 810076
(http://support.microsoft.com/default.aspx?scid=kb;en-us;810076).
Mr. Torgeir idea is great. I am thinking of it as follows:
1) creating WMI script
2) checking if the OS is XP with SP1
3) check if this hot fix is installed then exit. Otherwize install it (using
the Win32_QuickFixEngineering class)
Please need your advice if this script is fine. Also, how to install the
hotfix
using the WMI script?
Regards Tag: registerring ocx and dll files Tag: 179146
scripting the Regional Settings control panel app
I am a newbie to scripting. How would I use a script to change the date and
time formats in the Regional Settings control panel icon. I use a another
script that chokes if the date and time format is not set a certain way. But
this setting is not one I am used to seeing and is confusing sometimes. I
would like to be able to just toggle back and forth using a script that is
run from a batch file.
Thanks in advance,
Derick Tag: registerring ocx and dll files Tag: 179131
IF/THEN based on local group membership?
Hello,
I know the general question of how to add a domain group to the local
administrators group has been asked many times and I have the code to do
that part. My dilemma is, since I want to encapsulate the script in a
computer startup script in a GPO, it's going to run every time the machine
starts; if the group already is a member, it will throw an error. Yes, I
could run "on error resume next" but the bosses still classify this as an
"error" (though to me it just seems like a piece of information) and want me
to check the existence of the domain group in the local admins first, and
skip the "add" if it's present.
I've looked everywhere and can't find the code to check the membership of a
local group much less construct the IF/THEN statement needed to go with it.
If anyone can point me in the right direction I would be most appreciative. Tag: registerring ocx and dll files Tag: 179129
creating a login script that will copy all of my documents to netw
Is there a way to copy all of the contents of "My Documents" from all my LAN
users to a network drive share? For some reason my VP will not allow me to
redirect everyone's "My Docs" to a network drive but does want a copy stored
on the server for backup purposes.
I would like this to be automated via a login in script...is this possible?
Thanks in advance. Tag: registerring ocx and dll files Tag: 179127
Dynamic DNS
I found the following script in an earlier posting. It is to enable DHCP and
set the DNS servers IP addresses. What changes should be made to this script
if I want the client to be set to "Obtain DNS server automatically" rather
than specifying the DNS server address?
================================================
'
' script enables DHCP, adds DNS sufix, and DNS server IP addresses on all NICS
'
'================================================
Option Explicit
'On Error Resume Next
Dim target
Dim oWMIService
Dim colNetAdapters
Dim oNetAdapter
Dim DNSDomainErr
Dim DNSsearchErr
Dim DNSServer
Dim oProvider
Dim oDom
Dim oOU
Dim qQuery
Dim oConnection
Dim oCommand
Dim oRecordSet
Dim errEnable
oProvider = "'LDAP://"
oDom = "dc=fulldomainname, dc=fulldomainname, dc=fulldomainname'"
oOU = "ou=Test OU,"
qQuery = "Select Name from " & oProvider _
& oOU & oDom & "where objectClass='computer'"
Set oConnection = CreateObject("ADODB.Connection")
Set oCommand = CreateObject("ADODB.Command")
oConnection.Open "Provider=ADsDSOObject;"
oCommand.ActiveConnection = oConnection
oCommand.CommandText = qQuery
Set oRecordSet = oCommand.Execute
While Not oRecordSet.EOF
Target = oRecordSet.Fields("name")
DNSserver=Array("192.168.0.1", "192.168.0.2")
Set oWMIService = GetObject("winmgmts:\\" & target & "\root\cimv2")
Set colNetAdapters = oWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each oNetAdapter In colNetAdapters
DNSDomainErr = oNetAdapter.SetDNSDomain("fulldomainname")
DNSsearchErr=oNetAdapter.SetDNSServerSearchOrder(DNSserver)
WScript.Echo "DNSDomain returned " & (DNSDomainErr)
WScript.Echo "DNSsearchOrder returned " & (DNSsearchErr)
errEnable = oNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
Next
oRecordSet.MoveNext
Wend
oConnection.Close Tag: registerring ocx and dll files Tag: 179126
Folder Copy
I'm new to scripting. Please advise how can I copy a user's desktop folder to
network drive. I want the script to copy this for multiple PCs. I'm not sure
what variable (ex: c:\%username%\desktop), if any, to use.
Source PC is NT wks 4.0.
Thanks for your assistance.
Sample script below is unable to locate folder:
Dim = objFSO
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
If (objFSO.FolderExists("%userprofile%\desktop")) Then
objFSO.CopyFolder "%userprofile%\desktop", "f:\desktop"
Else
WScript.Echo("Unable to locate folder")
End if
Set objFSO = Nothing
Wscript.Quit Tag: registerring ocx and dll files Tag: 179124
VBScript errors with Date?
Hi,
I was playing with date functions in VBScript, finding some scary and
may be buggy behaviour.
For example, the following script:
[vbscript]
dim s
dim d
s = "12/01/2005"
d = datepart("m",s)&"/"&datepart("d",s)&"/"& datepart("yyyy",s)
MsgBox "s = " & s & " d = " & d
s = "13/01/2005"
d = datepart("m",s)&"/"&datepart("d",s)&"/"& datepart("yyyy",s)
MsgBox "s = " & s & " d = " & d
[/vbscript]
- In the first case gives: s = 12/01/2005 d = 12/1/2005
- In the second case gives: s = 13/01/2005 d = 1/13/2005
In the second case it swaps day by month (may be according to local
machine format) BUT in the first case it has not changed it.
Some idea of what is happening behind the scenes?
Regards,
Sebastian Wain
--
http://www.nektra.com Tag: registerring ocx and dll files Tag: 179121
Script Problem
I have a script that runs another command line program called
upgrade_export.exe. I pass it a path where I want a file the program
generates placed. Unfortunately upgrade_export.exe prompts for user input.
It says to hit enter to continue. I am using WshShell.SendKeys("~") to send
the Enter key. If I run my script from the command line it works perfectly.
If I schedule a task and run it while logged into the server console, it
works perfectly. If I run it as a scheduled task while not logged in the
scheduled task runs, the script runs the .exe, but it stays at the prompt to
hit enter to continue. So somehow my WshShell.SendKeys("~") command is not
working correctly. I have WScript.Sleep(3000) in before the
WshShell.SendKeys("~") in case it is a timing issue, but no matter what
sleep time I put in it still fails when not logged in.
The server is Windows 2003 Enterprise Edition. This script used to work
fine on Windows 2000 Server. I guess something changed in 2003 that is
breaking it. Also, I am no programmer. I am lucky that it ever worked.
Here's the script. If anyone has any helpful hints on how to do it better
please, I am all ears.
Thanks,
Robbie
On Error Resume Next
dim WshShell, WshNetwork, obj, currtime, curryr, currmo, currdy, currtm,
strResult
dim objService, objLocator, strLocalComputer, runPath1, runPath2
dim Filewithpath
Set WshNetwork = CreateObject("WScript.Network")
strLocalComputer = WshNetwork.ComputerName
Set objService = GetObject("winmgmts:\\" & strLocalComputer & "\root\cimv2")
for each obj in objService.InstancesOf("Win32_OperatingSystem")
currtime=obj.LocalDateTime
Next
Set FSO = CreateObject("scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("Wscript.Network")
curryr=left(currtime,4)
currmo=mid(currtime,5,2)
currdy=mid(currtime,7,2)
currtm=mid(currtime,9,6) 'will give time as 103956 for 10:39:56
strDateTime = ""
strDateTime = currmo & "-" & currdy & "-" & curryr
runPath1 = "D:\Backups\upgrade_export.exe D:\Backups\" & strDateTime & "_" &
strLocalComputer & "_Backup"
Set WshShell = CreateObject( "WScript.Shell" )
WshShell.Run runPath1
WScript.Sleep(3000)
WshShell.SendKeys("~")
WScript.Sleep(30000)
strFileName = strDateTime & "_" & strLocalComputer & "_Backup.tgz"
sResults = FSO.BuildPath("D:\Backups\", strFileName)
dResults = FSO.BuildPath("W:\", strFileName)
WshNetwork.MapNetworkDrive "W:", "\\10.1.1.190\Backup", "False",
"DOMAIN\user", "password"
WScript.Sleep(6000)
FSO.CopyFile sResults, dResults, True
WScript.Sleep(6000)
WshNetwork.RemoveNetworkDrive "W:"
wscript.quit Tag: registerring ocx and dll files Tag: 179119
distributing vbscript and associated files as one file
Is there a way to distribute a VBScript script together with
any auxilliary files so that:
- everything is in a single file
- the user just runs that single file to run the program,
i.e. there is no explicit installation process (although
there may be some installation going on behind the scenese
the first time it is run, say)
- the source is NOT hidden from the user (its ok if an extraction
process is required)
In case there are specific solutions for special cases,
there are several cases:
Case 1. the auxilliary file is an ordinary COM object
Case 2. the auxilliary file is a .WSC COM object
Case 3. any number of auxilliary files of unspecified type Tag: registerring ocx and dll files Tag: 179118
script to get all the groups from AD
I am running this script:
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set File = fso.CreateTextFile("c:\Groups\Allgroups.txt", True)
Set colItems = GetObject _
("LDAP://ou=APP_Grps,ou=cam,ou=im,dc=nAm,dc=nsroot,dc=net")
'colItems.Filter = Array(â??Userâ??, "Computer")
For Each objItem in colItems
File.Write objItem.CN & vbCRLF
Next
and I get about 8 out of about 900 groups and it ends with Exit code: 0 ,
0000h
can you please help me Tag: registerring ocx and dll files Tag: 179116
VBScript to restart a server
I have a series of servers that I need to restart and just plain shut down.
Is there a VBS way to do this so I don't have to write a big batch file?
--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company Tag: registerring ocx and dll files Tag: 179115
Printer Config Dump
I have a broken Microsoft print cluster I am looking to repair, and to
do so I first need to dump all defined clustered printer configuration
information on one of my servers, such as printer name, printer IP
address, driver name, printer model, printer options (such as if duplex
enabled), etc. I'd like as much printer information as possible to be
dumped. I know this should be possible. Does anyone have a sample
script they can share to get me started. Thanks! Tag: registerring ocx and dll files Tag: 179104
Win32_NetworkAdapterConfiguration - SetDNSServerSearchOrder()
Hi! :-)
I'm having problems with the SetDNSServerSearchOrder method of the
Win32_NetworkAdapterConfiguration object.
It works just fine on Windows XP mashines but when I run it on a 2k mashine
IP dies and I have to go in and set it manually to static ip and back to get
it working again... (A reboot is not enough.)
I have among other things tried the example script Dns-replaceserverlist.vbs
from
http://www.microsoft.com/technet/scriptcenter/topics/networking/05_atnc_dns.mspx. I
have tested both setting the arrNewDNSServerSearchOrder variable to Null and
running SetDNSServerSearchOrder with no arguments. Both ways are supposed to
work and does on XP...
I first made a script reading and setting the settings in the registry but
thought I'd use wmi to avoid a reboot.... If I don't get it to work I'll go
back to the registry version since it works just fine on both 2k & xp.
Thanks a million! :-)
/Sofia Tag: registerring ocx and dll files Tag: 179102
Shortcut
Hi all
I have a login script which which copies a shortcut which is located on a
mapped drive to the desktop but I would like to change this so that it
creates a new shortcut instead of just copying one over. The shortcut will
point to an Access database and workgroup file on a shared folder(database)
on a file server(server1). When i manually create the shortcut file these are
my parameters
Target : "C:\Program Files\Microsoft Office\Office\msaccess.exe"
"\\server1\database\DB1.mdb" /WRKGRP "\\server1\database\DB1WG.mdw"
Start in: "C:\Program Files\Microsoft Office\Office"
Any help would be greatly appreciated
Gerry Tag: registerring ocx and dll files Tag: 179099
For Next and the Folder object
Hi Folks,
Trying to create a clean-up script. 2 things getting in my way. (I can
access My Docs OK.)
1) I'm trying to go through all folders in My Documents, and delete all
folders that don't start with MY
For each fld in strMyDocs
If Left(fld.Name,2) <> "My" then
objFSO.DeleteFolder(strMyDocs)
End If
Next
My For Next doesn't work - I can't seem to cycle through each folder in My
Docs. How do I access the folder objects? Something to do with
objFSO.GetFolder(fld) ?
2) How do you empty the recycle bin via script?
Is it an empty folder command? Don't know this one...
TIA,
Piers Tag: registerring ocx and dll files Tag: 179098
Error code 0x80041003
This is a multi-part message in MIME format.
------=_NextPart_000_0012_01C59F57.592F2440
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
When logging as local administrator, I can add some instances in my MOF =
file to WMI repository successfully. But when loging as an domain =
account (that belongs to local administrators group), I cannot. In =
%windir%\system32\wbemlogs\wbemess.log, I see "Error Code 0x80041003".
I know this is an permission error, but I don't know how to solve this.
Any solution?
------=_NextPart_000_0012_01C59F57.592F2440
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.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When logging as local administrator, I =
can add some=20
instances in my MOF file to WMI repository successfully. But when =
loging as=20
an domain account (that belongs to local administrators group), I =
cannot. In=20
%windir%\system32\wbemlogs\wbemess.log, I see "Error Code=20
0x80041003".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I know this is an permission error, but =
I don't=20
know how to solve this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Any =
solution?</FONT></DIV></BODY></HTML>
------=_NextPart_000_0012_01C59F57.592F2440-- Tag: registerring ocx and dll files Tag: 179095
Convert images size
Hello all
My question is:
I've a folder with a several files about 1.4 Mb for each file, I need put
them to the Interner Album but I search the way to redure the size
automatically. (e.g. reduce the actual size to 640)
There is a script allows mw to do it? other advice?
Thanks a lot
henpat
-.............-
Convert images size Tag: registerring ocx and dll files Tag: 179093
Hi guys,
I'm looking at writing a script that checks to see if a dll is registerred
and if not willl register it.... can anyone assist ?