wmi or vbscript help
Hi, I'm not a coder by any means, but I'm slightly wet behind the ears.
What I'm looking to do is the following:
I am responsible for imaging several desktop and laptop computers in our
school district, and one of the mundane tasks I must do after each machine
has been imaged is to remove the 2 checkmarks under startup and recovery
options in windows xp (time to display list of operating systems and time to
display list of recovery options...) It get's to be a hassle to do this
every time I image a machine, and was hoping that this could be done via a
script. Unfortunately, I've not been able to find any info on how to do
this with either wmi or vbscript. I was able to find info on setting the
timeout, but I really need to be able to disable both of these options
alltogether.
So, any ideas, sample scripts, things to look for, etc???
Thanks,
Doug Tag: Hide UNC in path under mapped drive? Tag: 208272
problems delete files and folders from desktop for domain user
We have a script that will delete files and folders from the desktop
on login. However, the users logging in have their profiles as
user.domain and not user so when the script runs it is deleting things
from c:\documents and settings\user\desktop instead of c:\documents
and settings\user.domain\desktop. I forget what to add. Part of the
script is below. Thanks.
strDesktop = objWSH.ExpandEnvironmentStrings("%UserProfile%\desktop\")
'*******Delete Files and Folders from desktop*******
Set Shell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = Shell.SpecialFolders("Desktop")
objFSO.DeleteFile (DesktopPath & "*.*")
objFSO.DeleteFile(strDesktop & "*.*")
objFSO.DeleteFolder(strDesktop & "*.*") Tag: Hide UNC in path under mapped drive? Tag: 208270
Global module limit of size of text?
I have a process that combines many vb functions into a single String
object.
This is then added to the VBScript control via the AddCode method.
Implicitily this becomes part of the global module.
When the script runs i start to get errors - because some of the
functions are missing.
This happens when the text reaches a certain limit.
So is there a limit on the text that you can add to the global module?
How can i resolve this problem?
Thanks. Tag: Hide UNC in path under mapped drive? Tag: 208269
Disable Start Button
Hi all. I am trying to lock down computers for certain users for
security reasons. Is there a way that i can disable to start button at
logon without having to then reboot the computer. Everything I have
found says that it only works after I have logged in, then off and
then logged back in again. I would like to disable the start button
using VBS.
Any help in this matter would be highly appreciated.
Thank you Tag: Hide UNC in path under mapped drive? Tag: 208268
Two CSV file data to new excel file
I am having two CSV files. I need to generate new excel file while
running VBSCRIPT. That newly generated excel file sheet1 data should
be first csv file data and the same file sheet2 data should be second
csv file data.Newly generated excel file sheet1 name should be name of
the first csv file and the same file sheet2 name should be name of
the second csv file.I need only in VBSCRIPT not in VBA
Thanks in advance for your help Tag: Hide UNC in path under mapped drive? Tag: 208264
Re: placing computers OUs depending on where the user is
Hi,
I am looking for a script that will move computers to a OU depending
on where the user is place in AD.
For example, if a user is in OU=IT,DC=TEST,DC=COM I would like to
computer to be placed in that container or even better a container
underneath
ie OU=ITCOMPUTERS,DC=TEST,DC=COM
I was hoping this could be done via a vbscript
TIA
Oli Tag: Hide UNC in path under mapped drive? Tag: 208255
Monitoring script for run away processes
I have a need to create a script that will create an event log entry on the
local machine for any process that starts with nv* and has been running over
20 hours?
Does anyone have and idea on how to complete this?
--
Nick Tag: Hide UNC in path under mapped drive? Tag: 208254
Document conversion
Hello all.
I have an exchange 2003 environment with over 300 user accounts.
When we get a new user, I create an HTM signature file, open it in
word, save it as RTF and then save as TXT. These files are put in a
folder on a network share named the same thing as the user's
username.
For example, the user's name is john smith. On the network share,
would be a folder called jsmith, and within that folder would be 3
files, signature.htm, signature.rtf and signature.txt.
During the login, the login script takes these files and Xcopies them
into the signatures folder in the user's profile. I then have a VBS
script (courtesy of Sue Mosher, microsoft MVP) that sets this
signature file as the current signature.
My problem is this... I do not want to have to OPEN the HTM file to
create the RTF and the TXT. I COULD create the rtf simply by doing an
xcopy "path\sig.htm path\sig.rtf" and that works fine. Trouble is when
creating the TXT, ALL the html code becomes visible.
Is it possible at all to do this via VB script?
Thanks in advance. Tag: Hide UNC in path under mapped drive? Tag: 208253
update today's date in a folder name, daily, via a script?
JustSomeGuy <JustSomeGuy@discussions.microsoft.com> wrote:
Looking for a way to have a folder whose name goes like this:
"Today is July 19, 2007"
and the date dynamically updates daily so it's always the correct day.
could this be simply done in a script that runs daily at some given time and
renames the folder?
> Is there a way to embed today's date in a folder name so that every
> day, the folder name always shows the correct date for that day?
>>I imagine you could write a script to regularly rename that folder, but that
>>isn't my area of expertise. Try posting in
>>microsoft.public.windows.scripting for more expert help. Tag: Hide UNC in path under mapped drive? Tag: 208252
Setting screensavetimeout via registry and getting it to take effect immediately
So I've seen a few posts on this topic, however nothing offering a
solid conclusion. I'm writing a script that is set to run on login
that resets the screensaver settings to a default setting, most
importantly overwriting the timeout to 10 minutes regardless of what
it is set to. I have a script that does that fine, the only problem
is that once the script runs, the machine needs to be rebooted again
for the change to be updated in the display properties. Some people
have said that i need to run user32.dll, updateperusersystemparameters
in order to fix the problem, however that doesnt' seem to work for
me. Surely there has to be some way of getting this done. Does
anyone have any suggestions? Here is my current script:
Set oShell = CreateObject("WScript.Shell")
oShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveTimeOut", "600"
oShell.run "c:\windows\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", 1, True
Others have said to do some type of API call, however i can't seem to
find any type of example for that. Tag: Hide UNC in path under mapped drive? Tag: 208250
Writing my 1st VBS "Script Component"
I am writing my furst VBS "Script Component" -- I have a bunch of VBScript
code for implementing websites and web-based applications on IIS/ASP. I was
thinking "Script Components" looked like a way to compact some of these
resources -- at least maybe cut down on the includes I am doing with my asp
files.
For example, I have a VBScript class in an asp file. Using the Script
Component Wizard, I created a typelib file and a wsc file that describe the
properties and methods of my VBS Class. Now, I'm supposed to put the VBS
code into the wsc "envelope" created by the Wizard.
My [blatantly-newbie] questions are these:
(1) Do I include the "Class" and "End Class" statements in the wsc file
somewhere? I would think not because if it is in a wsc file it -IS- a class;
is it not?
(2) Will this code now run any faster? Why or why not? The code is not
used inside any loops or anything. (Actually, it uses CAPICOM.dll to encrypt
payment transactions to PayPal.)
(3) Should the typelib be declared in the Application Object (i.e., in the
global.asa file)? Or should I just splice the reference into each ASP file
that uses it?
(4) Should the object be instantiated in the Application object? When { is
this | is this not } a good idea?
(5) Should I implement the ASP interface within this Script Component (for
the purpose of accessing the IIS Objects)? As a convenience, I define
certain constants there which adapt the set of files (i.e., the website) to
the configurations of different servers (e.g., data sources, smtp and pop3
addresses, things like that). But it's not that important. I suppose the
answer has something to do with server farms, loadsharing, and the scope of
ASP Objects. Any remarks?
Thanks for your kind assistance.
Jim Rodgers
------------
COMMENT: You know, it's kind of cool that such an often-disregarded
language (which I love anyway) can have classes, including enumerated
constants and all that jazz. The resonance among my VBA, VB6, and VBScript
code libraries is just amazing! Thank God for ten solid years of ASP
Classic, the MS Office Macro recorder, and IntelliSense! Tag: Hide UNC in path under mapped drive? Tag: 208248
Reg write to ScreenSaveTimeout not taking effect
So I've seen a few posts on this topic, however nothing offering a
solid conclusion. I'm writing a script that is set to run on login
that resets the screensaver settings to a default setting, most
importantly overwriting the timeout to 10 minutes regardless of what
it is set to. I have a script that does that fine, the only problem
is that once the script runs, the machine needs to be rebooted again
for the change to be updated in the display properties. Some people
have said that i need to run user32.dll, updateperusersystemparameters
in order to fix the problem, however that doesnt' seem to work for
me. Surely there has to be some way of getting this done. Does
anyone have any suggestions? Here is my current script:
Set oShell = CreateObject("WScript.Shell")
oShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveTimeOut", "600"
oShell.exec "%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", 1, True Tag: Hide UNC in path under mapped drive? Tag: 208243
computer name IF statment ?
Hello Everyone,
Below is code we use to map over network shared printers however was
wondering if there was some VB script code I could use to put a condition on
it. The condition being, if this person logs onto computer A then the
printers are mapped over but if the same user logs into computer B then the
printers are not mapped over. Any help on this would be great.
If InGroup( "Active Directory Printer Group" ) Then
Call AddPrinter ("domain", "computername", "printer name")
objWshNetwork.SetDefaultPrinter "UNC path to printer"
End If
Thank you
Alex Anderson Tag: Hide UNC in path under mapped drive? Tag: 208238
computer name IF statment ?
Hello Everyone,
Below is code we use to map over network shared printers however was
wondering if there was some VB script code I could use to put a condition on
it. The condition being, if this person logs onto computer A then the
printers are mapped over but if the same user logs into computer B then the
printers are not mapped over. Any help on this would be great.
If InGroup( "Active Directory Printer Group" ) Then
Call AddPrinter ("domain", "computername", "printer name")
objWshNetwork.SetDefaultPrinter "UNC path to printer"
End If
Thank you
Alex Anderson Tag: Hide UNC in path under mapped drive? Tag: 208237
Variable within 'Email Body'
I got this script that gets sent if something errors out. My problem
is that I would like to have the variable (source) be a part of the
message body.
This is what the message body looks like right now.
strEmailBody="Your machine PC has failed to backup one or more of the
requested files."
I want it to be like this:
strEmailBody="Your machine PC has failed to backup one or more of the
requested files from" &source". It was trying to backup to this
location: " &dest
However, when I try to do that it gives me an error: 'Expected end of
statement'
Thanks! Tag: Hide UNC in path under mapped drive? Tag: 208236
Creating nested folders (from file path provided by user)
Hello all,
I know how to create a single folder but suppose I pass thru command
line argument:
C:\cars\toyota\solara
and imagine none of those folders exist in the hard drive. How would
you use VBScript to create them?
Thanks a lot in advance. Tag: Hide UNC in path under mapped drive? Tag: 208231
variable within text
Here is my problem:
I have this line:
strEmailBody="Your machine PC has failed to backup one or more of the
requested files. To verify which files have been backed up visit <\
\fileserver\Fileserver\Cell Folders\Backups>. We recommend that you
figure out the cause of this issue and fix it or contact Information
Technology if you need assistance. Failure to do so might put you at
risk of losing critical data. If you have any questions or if you feel
that the information provided is not correct, please contact it.help.
Thank you for your time, IT Team."
I want to include the source in there which is a variable based on
what is being backed up. I can put &source at the end of that and it
shows up, however when I try to add it somewhere in the middle it only
shows up as &source and not the actual source.
I closing the quotes before &source and then creating new one
afterwards like so:
strEmailBody="Your machine PC has failed to backup one or more of the
requested files. To verify which files have been backed up visit <\
\fileserver\Fileserver\Cell Folders\Backups>. We recommend that you
figure out the cause of this issue and fix it or contact Information
Technology if you need assistance. " &source " Failure to do so might
put you at risk of losing critical data. If you have any questions or
if you feel that the information provided is not correct, please
contact it.help. Thank you for your time, IT Team."
but that gives me an error:
expected end of statement
How do I add in there?
Thanks! Tag: Hide UNC in path under mapped drive? Tag: 208230
Problem looping through OUs using LDAP
The following script pulls the User Name from one OU but I have ten
OUs that I want to pull this same information from and I am unable to
figure out a way to have the script loop through the other 9 OUs. The
OU=City part is what changes. Can anyone suggest a way to do this?
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Const ForAppending = 8
Const ForReading = 1
Dim fso, f
Text1 = "OU=Users,OU=City,OU=Division,dc=Mycompany,dc=local' WHERE
objectCategory='user'"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\testfile.txt", ForAppending, True)
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
strQuery = "SELECT Name FROM 'LDAP://" & Text1
objCommand.CommandText = strQuery
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
f.writeline objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
f.Close
objFile.Close Tag: Hide UNC in path under mapped drive? Tag: 208227
Read date from file and append new file
Hi,
This is probably basic stuff for the majority, however I am attempting
to write a little script to do the following:
I have a Process ID file (for Websphere), which has ONE entry init, a
number, say 1192. Whenever Websphere is restarted this Process ID
changes and hence the number in the PID file changes from 1192 to say
3456 (not appended).
What I want to do is write a little script, which picks up this entry
and write it into a new file, appending to it if and when it changes.
Does that make sense?
Cheers Tag: Hide UNC in path under mapped drive? Tag: 208226
Indexing a Word document
I have a document created with MailMerge function, now i need to
create and index (on a text or on a xml file ... anything goes) to an
external file.
In other therms, I need to know where is the starting page of any
letter, a cvs file that look like this
<merge cvs field 1>;<merged document page 1>
<merge cvs field 2>;<merged document page 2>
<merge cvs field 3>;<merged document page 3>
.
.
.
<merge cvs field n>;<merged document page n>
will be perfect.
Anybody have already tried this? Tag: Hide UNC in path under mapped drive? Tag: 208225
Problem witth New User Creation Script
All,
Can anyone please help. I have a VBScript which creates a new AD/
Exchange User, creates a new home directory, sets all the permissions
and then adds all the relevant groups.
The problem I have is that when the user first logs in his Home drive
is not mapped. I have checked and double checked the script and
nothing appears to be wrong. If I change the Home directory Drive in
AD and then apply the changes, then change the Drive back again it
works fine, so I don't think it is the Script.
Has anyone seen this before? Can anyone shed any light as to what
could be causing this?
All help is appreciated.
Kind Regards
Chris Tag: Hide UNC in path under mapped drive? Tag: 208223
Restart machine script help
Hi, I have the following script, the question is, i would like to add
2 things to this script but am not sure how to.
1) Create a log file for this that will show "username" and say "time"
and "date" it was ran.
2) Rarther than the machine name hard coded in the script allow a pop
up box so the user enters the machine name manually?
strComputer = "atl-dc-01"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next Tag: Hide UNC in path under mapped drive? Tag: 208222
Revoke DHCP Lease
Hi,
Does anyone know of a way to revoke DHCP address lease by hostname using a
script? I'm not too techie and dont know where to start.
all help and pointers appreciated. Tag: Hide UNC in path under mapped drive? Tag: 208219
Hot to run multiple programs with one script?
Hello everybody
i've the need to create a script that will run as a scheluded job
every day on a windows 2003 server machine.
The script's purpose is pretty simple: it has just to start 4 programs
(all progs have a gui but i dont need it to be visible) with a 10
second delay between each one..
Now due to my very basic scripting knowledge i can't figure out how to
realize this :(
Im trying the run method but only the first program starts, thern the
script wait for it to be terminated and start the second one etc...
while i need that all the program start.
This is the crappy code i wrote:
Dim oWS
Set oWS = CreateObject("WScript.Shell")
oWS.Run "C:\Applicativi\PssServer\PssServer.exe"
oWS.Run "C:\Applicativi\Dispatcher\dispatcher.exe"
oWS.Run "C:\Applicativi\CaricaBiglietti\CaricaBiglietti.exe"
oWS.Run "C:\Applicativi\NotificaQuote\StockQuote.exe"
Any help would be greatly appreciated Tag: Hide UNC in path under mapped drive? Tag: 208218
Revoke DHCP lease
Hi,
Does anyone know of a way to revoke DHCP address lease by hostname using a
script? I'm not too techie and dont know where to start.
all help and pointers appreciated. Tag: Hide UNC in path under mapped drive? Tag: 208217
This in VB6?
Hello,
This is a snippit from a VBScript routine.
Dim PINPad
Dim ResultString
Set PINPad = WScript.CreateObject("OPOS.PINPad")
WScript.ConnectObject PINPad, "EventHandler_"
The ConnectObject is my trouble. How would I do that in VB6?
Thanks Tag: Hide UNC in path under mapped drive? Tag: 208214
Execute VBS from Notepad++
Hi,
Is there a way to execute a VBS from within Notepad++? I know with ConTEXT
it could be done and had a button right on the toolbar to run the VBS.
--
Regards,
Martin X.
MCSA: M Tag: Hide UNC in path under mapped drive? Tag: 208210
questions on map printers based on groups
I am new to scripting and see the boundless opportunities. I admin about
100 pcs for a small private school and looking for a way to create printers
based on AD security groups. The script will run within their logon script.
Situation:
The users DO NOT have admin priviledges on the pcs. We have 5 network
printers that are different make and models. They are connected directly to
the network and we access with an ip address. Different users share the
same pc. Also I want to keep from having to touch each pc if possible.
Here are my questions:
1) Will I be required to go to each pc and install the drivers for the
printers that pc will use?
2) Will only the printers that are created and mapped with the script show
up in the printers folders?
3) Can a user w/o local admin rights run the script to install the printer.
4) Should I share the printers off the server rather than printing directly
to them over the network?
5) If printers are accessed as a share can varibles be used so that if the
share moves to another server only the varible needs to be changed (thinking
about varibles in a batch file)?
Here is my logon batch file
@echo off
net use * /delete /y
net use u: \\server\users\%username%
cscript %logonserver%\netlogon\logon.vbs
This is my logon.vbs script. I map drives based on groups
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
Select Case strGroupName
Case "group 1"
objNetwork.MapNetworkDrive "F:", "\\server\share1$"
Case "group 2"
objNetwork.MapNetworkDrive "G:", "\\server\share2"
End Select
Next Tag: Hide UNC in path under mapped drive? Tag: 208206
Hot to ru multiple programs in one script
Hello everybody
i've the need to create a script that will run as a scheluded job
every day on a windows 2003 server machine.
The script's purpose is pretty simple: it has just to start 4 programs
(all progs have a gui but i dont need it to be visible) with a 10
second delay between each one..
Now due to my very basic scripting knowledge i can't figure out how to
realize this :(
Im trying the run method but only the first program starts, thern the
script wait for it to be terminated and start the second one etc...
while i need that all the program start.
This is the crappy code i wrote:
Dim oWS
Set oWS = CreateObject("WScript.Shell")
oWS.Run "C:\Applicativi\PssServer\PssServer.exe"
oWS.Run "C:\Applicativi\Dispatcher\dispatcher.exe"
oWS.Run "C:\Applicativi\CaricaBiglietti\CaricaBiglietti.exe"
oWS.Run "C:\Applicativi\NotificaQuote\StockQuote.exe"
Any help would be greatly appreciated Tag: Hide UNC in path under mapped drive? Tag: 208201
Modifying DNS Settings for different subnets
Hey there guys,
I've written a script that installs an application, and the application
requires a specific DNS order for the machines in different subnets. The
problem is that I can't do a global GPO, because not everyone is getting this
software, and laptop users would then have a problem with accessing the
internet when they took it home.
What I need is a script that will check the machines gateway address, and if
it's a certain gateway, then it'll change the DNS settings according to
what's needed.
Example:
If gateway = 192.168.10.1
Then arrDNSServers = Array("192.168.10.2", "192.168.10.3")
ElseIf gateway = 192.168.50.1
Then arrDNSServers = Array("192.168.50.2", "192.168.50.3")
EndIf
If that makes sense...I know how to change the DNS settings for the
machine...it's pulling the default gateway address out of it. Any ideas?
Thanks again!
Best Regards, Tag: Hide UNC in path under mapped drive? Tag: 208200
How to run multiple commands
Hello everybody,
new to scripting here but i have the need to create a script that will
run as a scheduled task everyday.
The script has to start 4 programs, thisis what i tried but it dowsnt
go past the 1st run statement...
Dim oWS
Set oWSH = CreateObject("WScript.Shell")
oWSH.Run "C:\Dir1\SubDir1\App1.exe"
oWSH.Run "C:\Dir2\SubDir2\App2.exe"
oWSH.Run "C:\Dir3\SubDir3\App3.exe"
oWSH.Run "C:\Dir4\SubDir4\App4.exe"
I am probably doing a very noobish error here i know, any help would
be greatly appreciated
TIA
Massimo Tag: Hide UNC in path under mapped drive? Tag: 208199
How to run multiple commands
Hello everybody,
new to scripting here but i have the need to create a script that will
run as a scheduled task everyday.
The script has to start 4 programs, thisis what i tried but it dowsnt
go past the 1st run statement...
Dim oWS
Set oWSH = CreateObject("WScript.Shell")
oWSH.Run "C:\Dir1\SubDir1\App1.exe"
oWSH.Run "C:\Dir2\SubDir2\App2.exe"
oWSH.Run "C:\Dir3\SubDir3\App3.exe"
oWSH.Run "C:\Dir4\SubDir4\App4.exe"
I am probably doing a very noobish error here i know, any help would
be greatly appreciated
TIA
Massimo Tag: Hide UNC in path under mapped drive? Tag: 208198
How to run multiple commands
HI,
im new to scripting but i have the need to create a script that allows
me to run 4 executables.
This script will the be scheduled by the standard windows 2003
scheduler.
this is what i tried but it doesnt go past the first run statement
Dim oWS
Set oWSH = CreateObject("WScript.Shell")
oWSH.Run "C:\Dir1\SubDir1\App1.exe"
oWSH.Run "C:\Dir2\SubDir2\App2.exe"
oWSH.Run "C:\Dir3\SubDir3\App3.exe"
oWSH.Run "C:\Dir4\SubDir4\App4.exe"
Any help woukld be greatly appreciated
Massimo Tag: Hide UNC in path under mapped drive? Tag: 208197
Accessing WMI on a server - rights required?
Hi!
I'm writing a VBscript that will allow our account operators to create new
shares on our files server remotely, since we have an application requiring
the user home folder to be shared.
The problem is, when running this script with the account operators
credentials, we always got access denied when we are trying reading
information from the WMI:
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & ServName & "\root\cimv2")
As soon as we add them to the Administrators local group (something we want
to avoid), this is working perfectly.
I played with security into the WMI interface (giving Everyone full access
to WMI), but that fixed nothing.
Can somebody help me?
Thanks.
Claude Lachapelle
Systems Administrator, MCSE Tag: Hide UNC in path under mapped drive? Tag: 208196
Script to error writing to file
I have a script that will connect to Symantec's virus download site and get
the latest definitions. It seems to fail on line 42 'write to file failed'.
Can someone take a look and let me know what is wrong?
Thanks.
CONST DOWNLOAD_LOCATION = "http://definitions.symantec.com/defs/xdb/"
CONST HOST = "." ' make this value the hostname of the box this script will
run
CONST ADTYPEBINARY = 1
CONST ADSAVECREATENOTEXIST = 1
CONST ADSAVECREATEOVERWRITE = 2
CONST EVENT_SUCCESS = 0
Dim objHTTP : set objHTTP = CreateObject("Microsoft.XMLHTTP")
Dim objStream : set objStream = CreateObject("adodb.stream")
Dim objFSO : set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell : set objShell = Wscript.CreateObject("Wscript.Shell")
' Get the page source from the website.
objHTTP.Open "GET",
"http://securityresponse.symantec.com/avcenter/download/pages/US-SAVCE.html",
False
objHTTP.Send
' Cram the HTML source into memory. It's not a lot of data so there aren't
' really any performance concerns here.
Dim strHTMLSource : strHTMLSource = objHTTP.responsetext
' Parse memory for the location of of the download area. Once the download
' area is found, search for the file name.
If InStr(strHTMLSource, DOWNLOAD_LOCATION) > 0 Then
Dim intPosition : intPosition = InStr(strHTMLSource,DOWNLOAD_LOCATION)
Dim strFileName : strFileName = Mid(strHTMLSource, intPosition +
Len(DOWNLOAD_LOCATION), 12)
End If
' Cat the download area and the file name together to form the whole path.
Dim strPath : strPath = DOWNLOAD_LOCATION & strFileName
' Local dir to save file. Edit the const HOST as necessary for what computer
' will run this script.
Dim strSaveTo : strSaveTo = "\\" & HOST & "\c$\Program Files\SAV\" &
strFileName
' Make another connection to the website.
objHTTP.open "GET", strPath, False
objHTTP.send
' Open a pipe to download the file.
objStream.Type = ADTYPEBINARY
objStream.Open
objStream.Write objHTTP.responseBody
objStream.saveToFile strSaveTo, ADSAVECREATEOVERWRITE
WScript.Sleep 10000
' Check to see if file exists and write something to the local event log.
'If objFSO.FileExists(strSaveTo) Then objShell.LogEvent EVENT_SUCCESS,
strFileName & " was written to " & Mid(strSaveTo, 1, 27)
'End If
' Clean up.
set objHTTP = Nothing
set objStream = Nothing
set objShell = Nothing
Set objFSO = Nothing
MsgBox "Finished!" Tag: Hide UNC in path under mapped drive? Tag: 208195
Command line editor or script in order to add a new key to the Registry.pol file
Hello,
I need to add a "MyNewFile.exe" to the list of 'Run only allowed Windows
Applications' (RestrictRun).
This have to be done by my installation package.
Is there a command line editor or script in order to add a new key to the
Registry.pol file?
Regards. Tag: Hide UNC in path under mapped drive? Tag: 208193
Accessing Outlook Groups
Hi
I am not sure if this really falls under vbscript or VBA or is even
feasible, but is it possible to get access to a list of Outlook Groups
that a particular user has joined? And what would the best approach to
this be?
Thanks
Lawrence Tag: Hide UNC in path under mapped drive? Tag: 208192
Automating client IP configuration
I know very little about scripting, but I'm trying to automate IP
configuration on multiple clients and the script mostly works but the DNS
settings do not change. I am using the script found in this paper:
http://www.microsoft.com/technet/scriptcenter/topics/networking/09_atnc_scenario.mspx.
Here is the sample .csv file I'm testing with:
client1,add,staticip,10.10.1.30 192.168.1.30,255.255.0.0
255.255.0.0,10.10.0.1,1,TRUE,10.10.0.50 10.10.0.51,,training.com,,,,,,,,,,,
The settings after "TRUE" do not take effect (DNSServerSearchOrder,
DNSDomain).
Here is the file that is output after the script has run:
Date: 7/17/2007 2:07:17 PM
Adding updating or removing 1 new client computers.
------------------------------------------------------------------------------------------------------------------------
Host: client1
,Settings before changes:
,Computer Name:,,client1
,Workgroup:,,
,Domain Role:,,Standalone Workstation
,Ethernet 802.3 Adapter Local Area Connection
,,Index 1
,,Intel 21140-Based PCI Fast Ethernet Adapter (Generic) - Packet Scheduler
Miniport
,,DHCP Enabled: True
,,DHCP Server: 172.21.0.201
,,IP Addresses:
,,,,172.21.100.7
,,Subnet Masks:
,,,,255.255.0.0
,,Default Gateways:
,,,,172.21.0.1
,,Gateway Cost Metrics:
,,,,20
,,DNS Server Search Order:,,
,,,,172.21.0.201
,,DNS Domain:,,
,,DNS Domain Suffix Search Order:,,
,,Domain DNS Registration Enabled: False
,,Full DNS Registration Enabled: True
,,NetBIOS Over TCP/IP: Enable NetBIOS over TCP/IP
,,Primary WINS Server:
,,Secondary WINS Server:
,,DNS Enabled For WINS Resolution: False
,,WINS Enable LMHosts Lookup: True
,,WINS Host Lookup File:
,,WINS Scope ID:
,------------------------------------------------------------
,TCP/IP client change mode
,Client to be added to network.
,Administrator must make corresponding changes on servers.
,Static IP changes
,Network Adapter 1
,,Intel 21140-Based PCI Fast Ethernet Adapter (Generic) - Packet Scheduler
Miniport
,,Attempting to disable DHCP and enable static IP ...
,,DHCP disabled - static IP address enabled.
,,Assigned new default gateways.
,DNS Changes
,Network Adapter 1
,,Intel 21140-Based PCI Fast Ethernet Adapter (Generic) - Packet Scheduler
Miniport
,,Attempting to make changes in DNS configuration ...
,NetBIOS & WINS changes
,,NetBIOS Changes
,,Attempting to set NetBIOS Over TCI/IP value.
,,Unable to set NetBIOS Over TCI/IP value.
,NetBIOS Over TCP/IP setting does not require setting WINS parameters.
,------------------------------------------------------------
,Settings after changes:
,Computer Name:,,client1
,Workgroup:,,
,Domain Role:,,Standalone Workstation
,Ethernet 802.3 Adapter Local Area Connection
,,Index 1
,,Intel 21140-Based PCI Fast Ethernet Adapter (Generic) - Packet Scheduler
Miniport
,,DHCP Enabled: False
,,DHCP Server:
,,IP Addresses:
,,,,10.10.1.30
,,,,192.168.1.30
,,Subnet Masks:
,,,,255.255.0.0
,,,,255.255.0.0
,,Default Gateways:
,,,,10.10.0.1
,,Gateway Cost Metrics:
,,,,1
,,DNS Server Search Order:,,
,,DNS Domain:,,
,,DNS Domain Suffix Search Order:,,
,,Domain DNS Registration Enabled: False
,,Full DNS Registration Enabled: True
,,NetBIOS Over TCP/IP: Enable NetBIOS over TCP/IP
,,Primary WINS Server:
,,Secondary WINS Server:
,,DNS Enabled For WINS Resolution: False
,,WINS Enable LMHosts Lookup: True
,,WINS Host Lookup File:
,,WINS Scope ID:
------------------------------------------------------------------------------------------------------------------------
Summary:
Added 1 new client computers.
Updated 0 client computers.
Removed 0 client computers.
Unable to connect to or bind to WMI service on 0 client computers.
================================================================
Any help would be greatly appreciated!
Thank you,
Greg Tag: Hide UNC in path under mapped drive? Tag: 208185
WMI to check mountpoint, possible?
i have a volume mounted in a folder inside of a G drive. the free/used space
of the G drive is separate from the mountpoint however. how can i
specifically check drive spave for the mountpoint? an example would be
wonderful. thank you Tag: Hide UNC in path under mapped drive? Tag: 208183
setting write access on ftp vdirectories
I have been working on setting the accesswrite properity to true for 2
virtual directories without much luck. I can set it on the default ftp site,
but I seem to be having some trouble with the sub directories. I have tried
several methods without any luck. it would be really great ff someone could
take a look at the script below and give me a pointer. When I run it the
following error is returned
(2, 2) (null): 0x80005000
Dim IIsObj, vWrite
set IIsObj = GetObject("IIS://localhost/msftpsvc/2/Root/")
' Set the values.
' vWrite = true
'Put the values back in the object.
' IIsObj.AccessWrite = vWrite
'Save the changes back to the metabase.
IIsObj.put "AccessWrite", true
'iisobj.setinfo
TIA Stek Tag: Hide UNC in path under mapped drive? Tag: 208182
Get Oracle client version?
Is it possible to get the currently installed Oracle client version number
using
VBScript?
We currently use a mix of 8i and 10g.
If so, could you please post example code?
Thanks much in advance. Tag: Hide UNC in path under mapped drive? Tag: 208179
vbScript to Copy Files and Add either an Incrementing Value or DateStamp
Is there a VBScript that can copy:
C:\MyDirectory\MyFile.txt
and copy it to:
C:\MyArchive\MyFile (1).txt (The next time MyFile.txt is
copied it will be MyFile (2).txt, etc.
or
C:\MyArchive\MyFile0707170710.txt (i.e., July 17, 2007 07:10 AM)
with date stamp.
Thanks for any suggestions!
RBolling Tag: Hide UNC in path under mapped drive? Tag: 208176
Accessing ADS Information
I have written a login script foir my ADS domain but it doesn't work on all
computers. I included the script at the end of this post.
The problem seems to be the access to the ADS. It takes a awfull lkot of
time just to run the "CreateObject("ADSystemInfo")" command and when I try to
access the objADSystemInfo it takes a lot of time as well.
On my computer everything runs fine and on the computer of my colleague it
does not. We both use XP SP2 with all updates installed, so I really can't
find any difference. We are both Admins in the domain but this shouldn't
matter anyway.
If I remove the "On error..." I get an error at the "GetObject("LDAP://..."
command, so the first command does run but doesn't find anything?
Can anybody help me or provide me with some ideas how I can debug the
problem?
On Error resume next
Set objADSystemInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objADSystemInfo.UserName)
strDn = objUser.Get("distinguishedName")
strSam = objUser.Get("sAMAccountName")
strCn = objUser.Get("cn")
strLastLogon = objUser.Get("carLicense")
Set objLastLogon = objUser.Get("lastLogon")
intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart
intLastLogonTime = intLastLogonTime / (60 * 10000000)
intLastLogonTime = intLastLogonTime / 1440
Pos = Instr(strDn,"OU=")
if Pos = 0 then
strOu = ""
else
strOu = Mid(strDn,Pos+3,2)
end if
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "h:", "\\frodo\user\" & strSam
objNetwork.MapNetworkDrive "j:", "\\frodo\misc"
objNetwork.MapNetworkDrive "l:", "\\frodo\department"
objNetwork.MapNetworkDrive "p:", "\\frodo\projects"
objNetwork.MapNetworkDrive "k:", "\\frodo\department\" & strOu
strOut = "Welcome " & strCN & chr(13)
strOut = strOut & "Your last logon was:" & chr(13)
strOut = strOut & strLastLogon
objUser.Put "carLicense", "" & intLastLogonTime + #1/2/1601 22:00:00#
objUser.SetInfo
WScript.Echo strOut Tag: Hide UNC in path under mapped drive? Tag: 208174
Copy a file to a directory using vbscripting
I am looking for a VBScripting solution that copies MyFile.txt and
writes it to a destination directory like MyFile (2).txt if Myfile.txt
alread exists. OR (even better) adds a date stamp like
MyFile070717.txt
Source directory is:
C:\SourceDirectory\MyFile.txt
And the destination directory is:
C:\Archve\
Appreciate any suggestions!
RBolling Tag: Hide UNC in path under mapped drive? Tag: 208173
encrypt active scripting
Hello All- I have code written in MS Active scripting technologies.
Is there a way to encrypt the active scripting code so I can share
this code with others without them seeing my work?
Thanks
M Tag: Hide UNC in path under mapped drive? Tag: 208172
Tasks y VBScript
Hola buenas tardes,
Necesito Ayuda por favor......
Debo crear una tarea enviada desde Windows Server 2003 a los usuarios, para
ejecutar una script que debe leer una Unidad de red, por ejemplo:
*******************************************************
C:\red.vbs
*******************************************************
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set colDrives = WSHNetwork.EnumNetworkDrives
If colDrives.Count = 0 Then
MsgBox "No hay unidades que enumerar."
Else
strMsg = "Conexiones actuales a unidades de red: " & vbCrLf
For i = 0 To colDrives.Count - 1 Step 2
strMsg = strMsg & CRLF & colDrives(i) & Chr(9) & colDrives(i + 1)
Next
MsgBox strMsg
End If
********************************************************
El problema radica en que si envio la tarea con el comando:
AT \\nombreequipo 17:30 /INTERACTIVE "C:\red.vbs"
es creada con el usuario NT AUTHORITY\SYSTEM, pero este usuario NO PUEDE
LEER LA UNIDAD DE RED
Ahora si ejecuto la tarea con el comando:
SCHTASK /create /S nombreequipo /RU Dominio\Administrador /RP abc123 /SC
ONCE /TN "Lee red" /TR "C:\red.vbs" /ST 17:30 /IT /Z /F
Si se ejecuta con otro usuario (Dominio\pepe), ESTE NO LA PUEDE VER !
De igual forma si se ejecuta con el usuario SYSTEM, tampoco PUEDE LEER LA
UNIDAD DE RED
Que debo hacer ???
Muchas gracias de antemano por la colaboración.
OMZ Tag: Hide UNC in path under mapped drive? Tag: 208170
Script delete and copy file
Hello All,
Can someone help me with this. Basically, We got a font from a vendor and
they want us to overwrite the existing fonts thats on the C:\windows\fonts
folder with their fonts. I'm thinking of doing this using login script.
what do you guys thinK? I need a script that will delete files and at the
same time copy files into the folder.
Thanks in advance Tag: Hide UNC in path under mapped drive? Tag: 208161
Adding/Building a Scheduled Task
I have an installation that we are prepping for VISTA. After initial
install, we want our upgrade process to be silent, which is why I need
to build a Task during our initial install.
I think there is a way to do this as I've been provided this link in
another post (as a sidebar to a different topic):
http://msdn2.microsoft.com/en-us/library/aa384006.aspx .
Currently, when a user logs into our software we have an .exe that is
triggered to look in an .ini for versioning information and will
trigger a Windows Installer package (.msi) if needed. This .exe can
also be fired from a Start -> Programs -> Our App menu item.
I'm thinking that if I can't tie in the trigger in this fashion (logon
to our app or shortcut initiated), I would try to build the task as
(Windows) logon for any user.
So, basically, if I can't tie the trigger to my app, I simply need the
Task to fire our Our App Update.exe when any user logs onto their
workstation.
I know this link provides some good information, but I'm no expert
programmer by any means so any dumbing down that can be accomplished
would be greatly appreciated.
THANKS in Advance for any help, tips, pointers, etc.! Tag: Hide UNC in path under mapped drive? Tag: 208157
User Rights for login scripts
The following code works for anyone with administrator rights but not for the
general user accounts.
Can you please point me in the right direction.
Should I be using a diffrent methode to do this or do I need to assign
special right to the general user?
'=========================================================================
' Used to Map printers for users
'
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, objUser, CurrentUser
Dim strGroup, strUser, group
Const PrintServer = "\\premiere-bk-ad\"
Const PrintServer2 = "\\hq-pri-ad01\"
Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
For Each Group in CurrentUser.Groups
strGroup = strGroup & ucase(group.name) & " ***** "
Select Case ucase(group.name)
Case "CN=ED-ADMIN01-PRINTER"
objNetwork.AddWindowsPrinterConnection PrintServer & "ED-ADMIN01"
Case "CN=AWG01-PRT"
objNetwork.AddWindowsPrinterConnection PrintServer2 & "AWG01"
objNetwork.SetDefaultPrinter PrintServer2 & "AWG01"
wscript.Echo("AWG01")
end select
next
msgbox strgroup
--
Chris Hartmann
Premiere Credit of North america Tag: Hide UNC in path under mapped drive? Tag: 208152
I want to map my users directly to a folder within in a shared folder and
hide the unc path on the drive mapping under my computer.
"Cranium" <Cranium@discussions.microsoft.com> wrote in message
news:4F1C59BF-5904-45D7-B71C-902361091472@microsoft.com...
>I want to map my users directly to a folder within in a shared folder and
> hide the unc path on the drive mapping under my computer.
>
> Can anyone tell me how to do that?
>
>
>
>