Is login logged in on domain?
I need a script that will check to see if a login is logged in currently on
the domain, and if possible what workstation(s) it is logged in on. Any
suggestions? Tag: Network Configuration Tag: 190180
Scripting an uninstall process
I have an application that needs to be uninstalled regularly (needing
elevated privaleges) as our users are all restricted user accounts.
I don't know how to write a VBScript that will launch the Windows
uninstaller process.
The file in the program folder is called
"c:\TestLabUpdate\uninst32.isu" but how can I call this? And how do I
do it with admin privaleges?
Thanks for any help
-Fran- Tag: Network Configuration Tag: 190176
?? Passing Double-Quotes on the Command Line ??
Hi Everyone,
I don't know if this is so much a VBS question as a Windows question.
I want to pass several command line parameters to a VBS. Some of the
command line parameters have embedded double-quotation marks.
For example:
MyScript.vbs "title=She said, "Hello""
Unfortunately, I don't know how to successfully pass double quotation
marks on the command line. Using a backslash to escape the double
quotes does not work.
For example, this fails:
MyScript.vbs "title=She said, \"Hello\""
Is there a way to pass embedded double-quotes on the command line? This
seems so simple, it must be possible. I've searched Google high and low
to no avail.
Thanks much.
--
Alan Tag: Network Configuration Tag: 190173
Output to HTML
Obviously a newb question, i got scripts and want to output to HTML,
like scriptomatic does!! How do i do this??? Tag: Network Configuration Tag: 190171
Add a user to a folder's security tab
I am trying to add a user to the security tab for a folder. I can do it
manually, but my code fails.
I use code I found in a news group a bit modified:
Dim Sec 'Dim sec As New ADsSecurity
Dim sd 'Dim sd As IADsSecurityDescriptor
Dim Dacl 'Dim Dacl As IADsAccessControlList
Dim newAce 'Dim newAce As New AccessControlEntry
Dim WSHNetwork
Dim sFolderPath
Dim sTrustee
' Prolog
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set Sec = CreateObject("ADsSecurity")
sTrustee = WSHNetwork.UserDomain & "\" & WSHNetwork.UserName
sFolderPath = "S:\CLIENTS\FUNDS\000 test"
Set sd = sec.GetSecurityDescriptor("FILE://" & sFolderPath)
Set Dacl = sd.DiscretionaryAcl
On Error Resume Next
' Body
Set newAce = CreateObject("AccessControlEntry")
wscript.echo "New trustee: " & sTrustee
newAce.Trustee = sTrustee
newAce.AccessMask = ADS_RIGHT_GENERIC_ALL Or ADS_RIGHT_GENERIC_READ
Or ADS_RIGHT_GENERIC_EXECUTE _
Or ADS_RIGHT_GENERIC_WRITE Or
ADS_RIGHT_DELETE
newAce.AceFlags = ADS_ACEFLAG_UNKNOWN Or ADS_ACEFLAG_INHERIT_ACE
newAce.AceType = ADS_ACETYPE_ACCESS_ALLOWED
sd.Owner = newAce.Trustee
Dacl.AddAce newAce
'Removes everyone else from the permission
For Each newAce In Dacl
wscript.echo "Trustees already there: " & newAce.Trustee
If newAce.Trustee <> Trim(sTrustee) Then
Dacl.RemoveAce newAce
wscript.echo "Removing trustee: " & newAce.Trustee
End If
sd.DiscretionaryAcl = Dacl
Next
sd.DiscretionaryAcl = Dacl
sec.SetSecurityDescriptor sd
' trustees after the change
Set sd = sec.GetSecurityDescriptor("FILE://" & sFolderPath)
Set Dacl = sd.DiscretionaryAcl
For Each newAce In Dacl
wscript.echo "Trustees afterwards: " & newAce.Trustee
Next
' Epilog
If Err.Number <> 0 then
MsgBox Err.Description
End if
' Destroy all objects
Set sec = Nothing
Set sd = Nothing
Set Dacl = Nothing
Set ace = Nothing
Set newAce = Nothing
---
No user is added and current users are not deleted when I check the
folder's security tab after the code has run.
What am I doing wrong?
I use Windows 2000.
Regards,
Jan Nordgreen Tag: Network Configuration Tag: 190169
Determine SID
Hey Guys,
in:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1203.mspx
you have postet a worthwhile Scriptpart.
I've tried to adapt it to my needs.
But I get an Error, that this is a to complex Query.
So I've tried it with your Scriptomatic, but the result was the same error
"wbemErrProviderNotCapable 2147749924 0x80041024"
Here is what I try to do:
strComputer = "."
Set objWMIDienst = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colKonten = objWMIDienst.ExecQuery _
("SELECT * FROM Win32_SID", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objKonto in colKonten
Wscript.Echo objKonto.AccountName
Wscript.Echo objKonto.ReferencedDomainName
Next
Can you help me out a little? Tag: Network Configuration Tag: 190157
Remote Service Restart
Got an server that has some vendor specific services that I need to provide
ordinary users the ability to restart the services. I have gone ahead and
created a group and provided the stop_start ACL permissions (VIA
setACL.exe), but I need to be able to have the users restart these from a
remote machine.
Could anyone guide me as to which services/permissions need to be modified
to provide this user group permission to remotely attach and restart this
box. It currently is dying when it attempts to call the WMI serach (See the
code below).
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
setACL url http://setacl.sourceforge.net/html/examples.html
See example 23
--
Paul Bergson MCT, MCSE, MCSA, CNE, CNA, CCA
http://www.pbbergs.com
This posting is provided "AS IS" with no warranties, and confers no rights. Tag: Network Configuration Tag: 190152
Removing and adding printers
I'm moving our printers off the old file server and onto a new print
server appliance. I'm using the scripts from this page:
http://www.microsoft.com/technet/scriptcenter/scripts/printing/client/default.mspx
The problem is that I want it to delete all printer connections coming
from \\serverA. And create new ones to shares on serverB. I don't
mind having to specify in each script which printers to add, but I
don't want to assume to know which printers the computers currently
have installed. I just want to delete ALL connections to the old
server.
This is the script I have now, but it has to be set up knowing which
printer is currently installed. And worse yet, after it runs once, the
printer is deleted. Then when you run it again (at login) it gives you
an error because it can't find the connection. If I could just remove
the error from being displayed, then I could just list ALL of the
printers from the old print server in the script and that would cover
me.
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection "\\serverA\printer01"
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer01"
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer03"
WshNetwork.SetDefaultPrinter "\\serverB\printer03"
Thanks
Brandon Riffel Tag: Network Configuration Tag: 190151
Removing and adding printers
I'm moving our printers off the old file server and onto a new print
server appliance. I'm using the scripts from this page:
http://www.microsoft.com/technet/scriptcenter/scripts/printing/client/default.mspx
The problem is that I want it to delete all printer connections coming
from \\serverA. And create new ones to shares on serverB. I don't
mind having to specify in each script which printers to add, but I
don't want to assume to know which printers the computers currently
have installed. I just want to delete ALL connections to the old
server.
This is the script I have now, but it has to be set up knowing which
printer is currently installed. And worse yet, after it runs once, the
printer is deleted. Then when you run it again (at login) it gives you
an error because it can't find the connection. If I could just remove
the error from being displayed, then I could just list ALL of the
printers from the old print server in the script and that would cover
me.
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection "\\serverA\printer01"
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer01"
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer03"
WshNetwork.SetDefaultPrinter "\\serverB\printer03" Tag: Network Configuration Tag: 190150
remove nodes from xml
How do I remove all Handheld nodes/infomration from xml file? I would like
to know how to remove all HandHeld nodes and/or removing HandHelds
completly.
XML FILE FORMAT
<Store>
<HandHelds>
<HandHeld Number="51" MacAddress="00A0F8623CA0"
IPAddress="10.117.80.47" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
<HandHeld Number="52" MacAddress="00A0F84A1259"
IPAddress="10.117.80.48" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
<HandHeld Number="53" MacAddress="00A0F843E3FF"
IPAddress="10.117.80.49" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
<HandHeld Number="55" MacAddress="00A0F86240C9"
IPAddress="10.117.80.51" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
<HandHeld Number="54" MacAddress="00A0F84A089F"
IPAddress="10.117.80.50" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
<HandHeld Number="56" MacAddress="00A0F84B51FF"
IPAddress="10.117.80.52" Gateway="10.117.80.1" DNS="172.17.4.12"
SubnetMask="255.255.255.0"/>
</HandHelds>
</Store>
Const StoreXML_DROPOFF_DIR = "C:\Program Files\xml\"
Const StoreXML_FileName = "HHInfo.xml"
Dim xml
Dim HHnodeList
Dim HHnode
Dim HHNum
Dim j
Set xml = CreateObject("MSXML.DOMDocument") 'create intance of XML object.
xml.async = False
xml.load StoreXML_DROPOFF_DIR & StoreXML_FileName
Set HHnodeList = xml.selectNodes("//Store/HandHelds/HandHeld")
Set HHnode = xml.documentElement.selectSingleNode("//Store/Handhelds")
For j = 0 To HHnodeList.length -1
HHNum=HHnodeList(j).Attributes.getNamedItem("Number").value
WScript.Echo(HHNum)
HHnode.removeChild HHnode.childNodes.Item(HHNum)
Next Tag: Network Configuration Tag: 190148
Special Script help needed
Good Morning every body.
I want to make a script file which will hide Networks from the user. I know
I can hide the Network Neighbour hood icon through GP but still user can
access the network resources with \\PCNAME or \\DOmainNAme command in File
Open menu and they get the every thing they need.
Is there anybody have idea about it? Pl help me.
Thanks, Tag: Network Configuration Tag: 190147
remove this object
Belowe is a script that creates a shortcut in netplaces to a share. How can
I edit this so it will now remove this shortcut if the user has it?
Set wshShell = WScript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strNetHood = WshShell.SpecialFolders("NetHood")
strShareName = strNetHood & "\Amarillo JCAHO"
strNetworkPath = "\\amarillodw\Forms"
If Not objFSO.FolderExists(strShareName) Then
CreateFolderShortcut strShareName,strNetworkPath
Else
objFSO.DeleteFile(strShareName & "\Target.lnk")
Set objShortCut = WshShell.CreateShortcut(strShareName & "\Target.lnk")
objShortCut.TargetPath = strNetworkPath
objShortCut.Save
End If
'''''''''''''''''''''''''''''
' Create Folder Shortcut
'''''''''''''''''''''''''''''
sub CreateFolderShortcut(obj,npath)
' Create a folder object
set oFolder = objFSO.CreateFolder(obj)
' Create a target shortcut
set oShellLink = wshShell.CreateShortcut(obj & "\target.lnk")
oShellLink.TargetPath = npath
oShellLink.Save
' Create Desktop.ini file and make it hidden+system
Set oFile = objFSO.CreateTextFile(obj & "\Desktop.ini", True)
oFile.WriteLine("[.ShellClassInfo]")
oFile.WriteLine("CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}")
oFile.WriteLine("Flags=2")
oFile.WriteLine("ConfirmFileOp=0")
oFile.Close
set oAttrib = objFSO.GetFile(obj & "\Desktop.ini")
setattribute oAttrib,6
' Make object read-only
setattribute oFolder,1
end sub
'''''''''''''''''''''''''''''
' Set File/Folder Attributes
'''''''''''''''''''''''''''''
sub SetAttribute(obj,attr)
'mask for read/write attribute bits
' = readonly+hidden+system+archive
rw_bits = 1 + 2 + 4 + 32
oldattr = obj.attributes and rw_bits
newattr = oldattr or attr
obj.attributes = newattr
end sub Tag: Network Configuration Tag: 190146
Response.Write Text with DataField
Can someone please shed some light as to why this will not work
properly:
<%
If (News.Fields.Item("Chart").Value) = "" Then
Response.Write "Not Available"
Else
Response.Write "<img src='" &
News.Fields.Item("Chart").Value & "'>"
End If
%>
The check works fine...even the first response.write works... but the
second response.write never inserts the database field information. I
have 3 sets of data in the database, the first and last have data in
the "Chart" field (data in field = test), the second is empty. Here is
what I get:
<img src=''>
Not Available
<img src=''> Tag: Network Configuration Tag: 190142
global variable needed?
I have a file name hard coded in a SQL DTS execute process task as shown below:
cmd.exe /c wzunzip \\servername\share\filename.20060411.zip c:\temp\dir\ -o
Can I store a variable and call this file to be unzipped with the current
day/date? How could I use something like this:
Dim sNOW
sNOW = Date
sNOW = (Year(sNOW)*100 + Month(sNOW))*100 + Day(sNOW) Tag: Network Configuration Tag: 190141
Archiving website logfiles
I have a server (our main production one, with several websites on it)
that I want to archive the logfiles on. I have a script obtained from here:
http://www.iisfaq.com/Default.aspx?tabid=2809
running on another server, that is also a production server, but with
much less traffic on it.
The logfiles that are on the second server, are located in the default
directory for that installation of IIS. It runs the following vbscript
code fine and archives the log files fine. The script is located in the
\Windows\System32\Logfiles\W3SVC folder, along with the batch file that
calls it.
The script:
' http://support.microsoft.com/support/kb/articles/Q176/8/10.asp
Option Explicit
Const GENERAL_FAILURE = 2
Dim ArgObj, Servername, WebSiteID, WebSite, WebSitepath, MaxAgeOfFileToKeep
Dim Archivefolder, UseSpecificArchiveFolder
Const WinDir = "%WinDir%"
Function CreateFolderIfItDoesNotExist(FolderName)
Dim FSO
Set fso = CreateObject("Scripting.FileSystemObject")
if (fso.FolderExists(FolderName) = false) then
fso.CreateFolder(FolderName)
WScript.Echo "Archive folder created: " & FolderName
end if
Set Fso = nothing
End Function
Function RenameFile(oldName, newName)
Dim FSO, File
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.GetFile(oldName)
file.Name = newName
Set Fso = nothing
End Function
function ExpandPath(Path)
Dim key, ShellObject
if (left(Path, 8) = WinDir) then
Set ShellObject = WScript.CreateObject("WScript.Shell")
Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\PathName"
ExpandPath = ShellObject.RegRead(Key) & mid(Path,9)
Set ShellObject = Nothing
else
ExpandPath = Path
end if
end function
Function ReturnArchiveFileSize(FSO, CabFilename)
Dim FileObj
if (FSO.FileExists(CabFilename) = false) then
ReturnArchiveFileSize = 0
else
Set FileObj = fso.GetFile(CabfileName)
ReturnArchiveFileSize = FileObj.Size
set FileObj = Nothing
end if
end function
Function ArchiveThisFile(Filename)
Filename = lcase(filename)
if (right(Filename,4) = ".log") then
ArchiveThisFile = true
else
ArchiveThisFile = false
end if
end function
function FixNumber(Value, Length)
const Zeros = "0000"
if (Length-len(Value) > 0) then
FixNumber = Left(Zeros, Length-len(Value)) & Value
else
FixNumber = value
end if
end function
Function ReturnDatetime
Dim AMPM
if (Hour(TIME) < 12) then
AMPM = "AM"
else
AMPM = "PM"
end if
ReturnDatetime = FixNumber(Day(Date),2) & MonthName(Month(Date),true) &
FixNumber(Year(Date),4) & "_" & _
FixNumber(Hour(Time),2) & FixNumber(Minute(Time),2) &
FixNumber(Second(Time),2) & AMPM
end function
Function ArchiveOldLogFiles(WebSite, WebSiteLogPath, MaxAgeOfFile)
Dim File, ServerObj, FSO, FolderObj, FileObj, LogFileDir, Archived,
Status, FailedToArchive
Dim Filespec, OriginalLogfilename, CabFilename, LogFileSize,
ArchiveFileSize, FilesArchived
Dim CabFileSpec, CabFilesize, ReturnCode, WshShell, ArchivePercentage,
Command, NewFilename
LogFileSize = 0
ArchiveFileSize = 0
Archived = 0
FailedToArchive= 0
'on error resume next
' Attempt to get the web site object from the metabase
Err.clear
Set ServerObj = GetObject(WebSite)
If (Err.Number <> 0) Then
WScript.Echo "Error: " & Err.Description & " (" & Err.Number & ")"
Exit Function
end if
LogFileDir = ExpandPath(ServerObj.LogFileDirectory & "\" & WebSiteLogPath)
WScript.Echo "Log file dir for: " & ServerObj.LogFileDirectory & " = " &
WebSiteLogPath
Set ServerObj = Nothing
WScript.Echo "Log file dir for: " &WebSite & " = " & LogFileDir
Set FSO = CreateObject("Scripting.FileSystemObject")
' Check if the log file directory exists
if (FSo.FolderExists(LogFileDir) = false) then
WScript.Echo "Log file directory does not exist: " & LogFiledir
Exit Function
end if
set Folderobj = FSO.GetFolder(LogFileDir)
for each File in Folderobj.files
if (ArchiveThisFile(File.Name) = true) then
if (Date - File.DateLastModified > cint(MaxAgeOfFile)) then
OriginalLogfilename = file.name
LogFileSize = LogFileSize + File.Size
Status = "Archiving File: " &File.name & ", Age="& _
formatNumber(Date-File.DateLastModified, 0) & " days, Status="
Err.Clear
if (UseSpecificArchiveFolder = false) then
Filespec = LogFileDir & "\" & File.Name
CabFileName = left(file.name, len(File.name)-3) + "cab"
CabFileSpec = LogFileDir & "\" & CabFileName
else
NewFilename = WebSiteLogpath & "_" & ReturnDateTime & "_" & File.name
CabFilename = left(NewFilename, len(NewFilename)-3) + "cab"
CabFileSpec = ArchiveFolder & "\" & CabFileName
call RenameFile(LogFileDir & "\" & File.Name, NewFilename)
Filespec = LogFileDir & "\" & NewFilename
end if
Set WshShell = WScript.CreateObject("WScript.Shell")
' http://msdn.microsoft.com/scripting/windowshost/doc/wsMthRun.htm
Command = "makecab " & chr(34) & Filespec & chr(34) & " " & chr(34)
& CabFileSpec & chr(34)
ReturnCode = WshShell.Run(Command, 7, True)
If (Err.Number <> 0) Then
Status = Status & "Failed : "& Err.Description & " (" & Err.Number
& ")"
FailedToArchive = FailedToArchive +1
elseif (ReturnCode <> 0) then
Status = Status & "Failed : Return code from MAKECAB.EXE was " &
ReturnCode
FailedToArchive = FailedToArchive +1
else
Status = Status & "Archived " & OriginalLogfilename & " to " &
CabFilename
CabFilesize = ReturnArchiveFileSize(FSO, CabFileSpec)
' This is just a sanity check to make sure the archive was created
successfully.
if (File.Size > 0) and (CabfileSize > 0) and (CabFilesize <>
File.Size) then
FSO.DeleteFile(Filespec)
If (Err.Number <> 0) Then
Status = Status & ", Failed to delete original log file : "& _
Err.Description & " (" & Err.Number & ")"
end if
end if
ArchiveFileSize = ArchiveFileSize + CabFilesize
Archived = Archived + 1
end if
WScript.Echo Status
end if
end if
next
ArchiveOldLogFiles = Archived
WScript.Echo
"-------------------------------------------------------------------------"
if (FailedToArchive > 0) then
WScript.Echo "There were " & FailedToArchive & " files that could
not be archived!"
end if
if (LogFileSize =0) then
ArchivePercentage = "0%"
else
ArchivePercentage = FormatNumber(100-((ArchiveFileSize /
LogFileSize) * 100), 2) &"%"
end if
WScript.Echo Archived & " log files archived, original = " & LogFileSize
& ", archived = " & ArchiveFileSize & _
" saving " & LogFileSize - ArchiveFileSize & " bytes or " &
ArchivePercentage
end function
Sub DisplayHelpMessage()
WScript.Echo
WScript.Echo "Usage:"
WScript.Echo " ArchiveOldWebSiteLogfiles.VBS MaxDays [-A
ArchiveFolder]"
WScript.Echo
WScript.Echo "MaxDays = If a file is older than this it will be
archived."
WScript.Echo
WScript.Echo "ArchiveFolder = Optional parameter that specifies the
location"
WScript.Echo " where the .CAB files get written. When using this
option two"
WScript.Echo " major things happen. The CAB filename and the log
filename"
WScript.Echo " are built using this format SI_D_T_O where"
WScript.Echo
WScript.Echo " S=Service such as W3SVC, MSFTPSVC"
WScript.Echo " I=Instance such as 1 for default web site"
WScript.Echo " D=Current Date"
WScript.Echo " T=Current Time"
WScript.Echo " O=Original log filename"
WScript.Echo
WScript.Echo " ex010423.log becomes
W3SVC1_19May2001_085937AM_ex010423.log"
WScript.Echo
WScript.Echo "Example: cscript ArchiveOldWebSiteLogfiles.VBS 50"
WScript.Echo
WScript.Echo "This script will archive the LOG files in all WEB and
FTP sites into a .CAB"
WScript.Echo "file. You can extract the files from the CAB file by
using the EXTRACT command"
WScript.Echo "which is included with Windows."
WScript.Echo
WScript.Echo "Note: The original log file is deleted"
WScript.Echo
WScript.Echo "Please visit and support : http://www.iisfaq.com"
end sub
Sub DoWork(Service, ClassName)
Dim IISObj, Object, ServicePath
ServicePath = "IIS://" & ServerName & "/" & Service
Set IISOBJ = GetObject(ServicePath)
if (err <> 0) then
WScript.Echo "Failed to read service " & Service & " for path " &
Servicepath & " : " & _
Err.Description & " (" & Err.Number & ")"
exit sub
end if
for each object in IISOBJ
if (Object.Class = ClassName) then
WScript.echo "Site = " & Object.Name & " - " & Object.ServerComment
WebSitepath = "IIS://" & Servername &"/"& Service & "/" & Object.Name
Call ArchiveOldLogFiles(WebSitePath, Service & Object.Name,
MaxAgeOfFileToKeep)
WScript.Echo
end if
next
Err.Clear
Set IISOBJ=Nothing
end sub
Sub CheckCommandLine()
Dim OArgs, ArgNum
Set oArgs = WScript.Arguments
ArgNum = 0
UseSpecificArchiveFolder = false
ArchiveFolder = ""
If oArgs.Count < 1 Then
DisplayHelpmessage
WScript.Quit (GENERAL_FAILURE)
End If
While ArgNum < oArgs.Count
if (ArgNum = 0) then
MaxAgeOfFileToKeep = trim(oArgs(0))
else
Select Case LCase(oArgs(ArgNum))
Case "-a":
if (ArgNum+1 >= oArgs.Count) then
Call DisplayHelpmessage
WScript.Quit (GENERAL_FAILURE)
else
ArgNum = ArgNum+1
ArchiveFolder = oArgs(ArgNum)
' Strip off the last slash if provided.
if (right(ArchiveFolder,1) = "\") then
ArchiveFolder = left(ArchiveFolder, len(ArchiveFolder)-1)
end if
CreateFolderIfItDoesNotExist(ArchiveFolder)
WScript.Echo "Using archive folder : " & ArchiveFolder
UseSpecificArchiveFolder = true
end if
Case "--help","-?":
Call DisplayHelpmessage
WScript.Quit (GENERAL_FAILURE)
Case Else:
WScript.Echo "Unknown argument : "& oArgs(ArgNum)
Call DisplayHelpmessage
WScript.Quit (GENERAL_FAILURE)
End Select
end if
ArgNum = ArgNum + 1
Wend
end sub
CheckCommandLine()
Servername = "LocalHost"
WScript.Echo "Archive files over "& MaxAgeOfFileToKeep & " days old." &
vbcrlf
'on error resume next
DoWork "SMTPSVC", "IIsSmtpServer"
DoWork "W3SVC", "IIsWebServer"
DoWork "MSFTPSVC", "IIsFtpServer"
DoWork "NNTPSVC", "IIsNntpServer"
The Batch file that calls it:
rem -- back up iis log entries to a cab file on E drive
rem -- set for 1 days to keep on the server
cscript archiveoldwebsitelogfiles.vbs 01 -a e:\iislogarchive
pause
The problem is that on the production web server, the Logfiles are in
another folder structure entirely.
Where the above works fine on an IIS Server with a single website, on
logfiles in the \windows\system32\logfiles\w3svc folder, it does not
work on our main web server, since the logfiles on that server are
located in another directory structure entirely. On the site that the
script doesn't work on, the logfiles are located in:
E:\logfiles\Website1, E:\logfiles\website2, E:\logfiles\website3 and so on.
I'm not well-versed enough in vbscript to be able to figure out the
script above, or how to adapt it to a non-typical installation of IIS.
The one that the script is working on is a Windows 2000 server, the new
version is on a Windows 2003 server.
Can anyone help?
BC Tag: Network Configuration Tag: 190140
Screen Saver
Hai guys.I am having a screensaver file in (scr)format. I want to install in
all the client machine which we have in our network. Can u all help me to do
that using Login script.can u just give me a sample script.
--
MuraliKrishnan
Entry level Network Engineer Tag: Network Configuration Tag: 190135
Script
Hi all,
I am trying to write a script to do as follow: when a user loging in the AD
a window will pop-up showing with the message: user name, you belong to group
name
If anyone has something like that I appreciate,
Thanks,
Anderson Tag: Network Configuration Tag: 190131
AD sites
Hi all,
I would like to write a login script for our Finance department. Half
of the department are located at site1 and half at site2.
I'd like an IF statement in the script that would state:
IF users site = site1 then map printer1
ELSE map printer2
The sites are defined in AD.
I know that I could create a separate OU and a different login script,
but if this is possible I'd like to do it this way.
Can anyone hlp at all?
Thanks,
Gay. Tag: Network Configuration Tag: 190126
Newbie script help PLEASE. Scripting AD users profile path changes.
G'day all
I've got 98 users that I need to change their profile paths in AD.
I've got the following from the code examples
script start
Set objUser = GetObject
("LDAP://cn=SteveVai,ou=People,dc=Workplace,dc=com")
objUser.Put "profilePath", "\\server5\Profiles$\VaiS"
objUser.SetInfo
script finish
which I'm assuming should make the change for me but how do I arrange the
script to
take the input from a textfile full of the users names etc?
Thanks
Mark Tag: Network Configuration Tag: 190121
Excel Sheet manipulation from VB
Hello,
The situation in my code: VB has reached the last row for data entry in an
excel spreadsheet's current worksheet. Prior arrangement requires me to
start data entry on a new sheet.
The task I need to accomplish: Get VB to copy the current sheet (then I can
blank out filled cells to start afresh), or (preferably) open the blank
template, and copy out the empty sheet to existing .xls file (move to end).
Then finally, I need to close the .xlt and set focus on new sheet in .xls.
Also, I need to just switch easily between sheets inside the .xls.
I've copied below the required code in VBE:
Workbooks.Open Filename:= _
"C:\Documents and Settings\user\My Documents\MyTemplate.xlt",
Editable:= _
True
Sheets("Sheet1").Copy After:=Workbooks("MySheet.xls").Sheets(1)
ActiveWindow.ActivateNext
ActiveWindow.Close
Anyone have some ideas about converting the above to VB?
Much Thanks, Tag: Network Configuration Tag: 190118
Help needed
Hello forum,
I am new to scripting and need some help. I have manged to piece
together code that does most of what i need. The finishing touches
would be the following. Oh the script creates machine acounts in AD
from a spreadsheet. What I need the script to do now is to output a log
file of success or failure of creation of computer accounts. Also the
log files file name needs to be in the format Compscreated110406.log.
the last digits indicating the date the script ran. I have attached the
script as I cannot seem to paste the code correctly here. Thanks in
advance.
Van
+----------------------------------------------------------------+
| Attachment filename: createcomp-ver1_2.txt |
|Download attachment: http://www.codecomments.com/attachment.php?postid=2709294 |
+----------------------------------------------------------------+
--
vandergraafuk
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: Network Configuration Tag: 190117
Using MSComDlg.CommonDialog to make a Directory Browser in VBScrip
Hi,
I am having a problem with VBScript and the common dialog
(MSComDlg.CommonDialog).
What I am trying to do is build a dialog that allows me to select a target
directory. I am trying to copy this functionality from the Microsoft Word
2003
Dialog where a user can change the default path for documents. Tools -
Options -
File Locations - Documents - Modify. I know about the function
Shell.Application
- BrowseForFolder but it does look as good as the Office Dialog I want to
simulate.
So really in the code below I want to make it only browse directories and
remove the file filter (Files of type:) - how can this be done. As well
I want to make it only display directories and not list any files.
Enough waffle - here is the code.
Thanks,
Ward.
Public Const ofnAllowMultiSelect = &H200
Public Const ofnCreatePrompt = &H2000
Public Const ofnFileMustExist = &H1000
Public Const ofnHideReadOnly = &H4
Public Const ofnNoNetworkButton = &H20000
Public Const ofnNoReadOnlyReturn = &H8000
Public Const ofnNoTestfileCreate = &H10000
Public Const ofnNoValidate = &H100
Public Const ofnOverwritePrompt = &H2
Public Const ofnPathMustExist = &H800
Public Const ofnReadOnly = &H1
Public Const ofnShareAware = &H4000
Public Const ofnExplorer = &H80000
Public Const ofnNochangedir = &H8
Dim oComDlg
Dim path_name
Set oComDlg = CreateObject("MSComDlg.CommonDialog")
path_name = ""
With oComDlg
.DialogTitle = "Please select Target Directory"
.InitDir = "C:\"
.Filter = ""
.FilterIndex = 0
.MaxFileSize = 260
.FileName = "*.*"
.Flags = ofnPathMustExist Or ofnHideReadOnly Or ofnExplorer Or
ofnNoValidate Or ofnNochangedir
.ShowOpen
End With
path_name = Left(oComDlg.filename,InStrRev(oComDlg.filename,"\"))
If path_name = "" Then
MsgBox "User Chose Cancel"
wscript.quit 0
End If
msgbox "Path Name" & path_name Tag: Network Configuration Tag: 190116
Help needed with setting registry premissions
We are in the process of locking down workstations at our company and
after doing so many of the applications we use don't work properly. We
have identified the registry keys that need permission changes (there
are 4 per user)
Is there a way we can write a script that will run under a system
context that will change these permissions in the registry? We have to
modify the key permissions to EVERYONE with FULL ACCESS on 4 keys.
Thanks for any insight!
-Fran- Tag: Network Configuration Tag: 190113
decoding REG_BINARY entries
hey all,
does anyone know how to decode the REG_BINARY entries in the
registry? I am able to retrieve the raw data, but I don't know how to make
any sense of it...
for example, if i want to see which services are loading in which order, i
look at
hklm\system\currentcontrolset\control\grouporderlist /V base /T REG_BINARY,
and i get the following data returned...
120000000E00000001000000020000000300000004000000
05000000060000000700000008000000090000000A0000000B0000000C0000000D0000000F000000
100000001100000012000000
I only used this as an example, what I am actually trying to do is query
DHCP servers for the 044 entries (WINS Servers)
(HKLM|Software\Microsoft\DHCPServer\Configuration\OptionInfo\044).. I know
the string value (IP address of the WINS servers), and I can actually do a
reg compare to see if the servers are configured with the proper WINS
servers, so I guess I'm just curious if anyone has been able to figure this
out... Do I need a special decoder ring? (Drink Ovaltine!)
Thanks in advance... Tag: Network Configuration Tag: 190112
Active Directory Migration Tool and Scripting
Hi all,
Firstly, please let me know if there's a better group to post to.
I'm writing a vbscript based on the ADMT v3. I've got everything running
the way I want, but I'd like to add some event handling. I'm trapping status
events by using the method described in the template.vbs file:
Sub Task_Status(lngEventType, strObjName, lngStatusType, objMessages)
'do stuff
End Sub
The only problem I have is with handling objMessages... I can't seem to make
any sense of it. I understand it's a system.array, and that the objects are
of type system.__comObject. I can't seem to find any info on actually
retrieving the messages.
Help!
Ceejayf! Tag: Network Configuration Tag: 190111
Populate multiple target directories from one source
I don't know if my title suits what it is I'm trying to do. I'm
looking to create for each of my user's home drives a common directory
structure. I'd like to have a script that will read from a input file
a list of user names. Based off of the list of user names a home
directory will be created on my target server\home\%username%
Along with creating the home drives I'd like to have each have
subdirectories created as well. I know that this is possible but I
don't know how Tag: Network Configuration Tag: 190101
Cleaner Way to write this?
This works but I am looking for a cleaner way to write it. Also is there a
way to display the seconds as well?
a = "4/28/06 11:00:00AM"
If (Index = 2) Then
b = Day(a) - Day(Now())
c = Hour(a) - Hour(Now())
d = Minute(a) - Minute(Now())
If (c < 0) Then
c = c + 24
b = b - 1
End If
If (d < 0) Then
d = d + 60
c = c - 1
End If
MsgBox "Days " & b & ", Hours " & c & ", Minutes " & d
End If Tag: Network Configuration Tag: 190100
Trying to post data to another server
Hi All,
Here's what I'm trying (got this code from MSDN):
Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
Set objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
Set objXMLSend = Server.CreateObject("Msxml2.DOMDocument.3.0")
Set objXMLReceive = Server.CreateObject("Msxml2.DOMDocument.3.0")
objXMLSend.async = false
objXMLSend.loadXML ("<msg><id>2</id></msg>")
objSrvHTTP.open
"POST","http://172.17.12.30/EEntryGateway/default.aspx",false
objSrvHTTP.send (objXMLSend)
Response.ContentType = "text/html"
Response.Write (objSrvHTTP.responseText)
The code executes fine, and on my calling page, I get the results of
the requested page (default.aspx) back. However, from the page that
was called, I can't figure out where the data I'm posting is going. It
doesn't appear in the Form collection anywhere...
What am I doing wrong? How do I sent POST data? Tag: Network Configuration Tag: 190088
Something wrong with my INSERT INTO
What is wrong with the below code?
It gives me error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/w/results.asp, line 24
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; (R1 1.3); .NET CLR
1.1.4322; .NET CLR 2.0.50727)
Page:
POST 65 bytes to /w/results.asp
POST Data:
T3=ssdf&T1=sdf&D1=No&D2=Sabre&D3=Greaves+Travel&T2=&SUBMIT=Submit
----------------------------------
I have a file protected.asp and the below line to submit data into
database.
<form action="results.asp" METHOD="POST">
Following is the contents of results.asp
----------------------------------
<%@ Language=VBScript %>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
dim dDate,dPNR,dSale,dGDS,dWebsite,dOWebsite,sql,connString
dDate = Request.Form("T3")
dPNR = Request.Form("T1")
dSale = Request.Form("D1")
dGDS = Request.Form("D2")
dWebsite = Request.Form("D3")
dOWebsite = Request.Form("T2")
connString = "your connection string"
'conn.Open connString
sql = "INSERT INTO data ( Date, PNR_Number, Sale, GDS, Website,
Other_Website) VALUES ('" & dDate & "','" & dPNR & "','" & dSale &
"','" & dGDS & "','" & dWebsite & "','" & doWebsite & "');"
cst = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("DB\db1.mdb")
set conn = CreateObject("ADODB.Connection")
conn.open cst
conn.Execute sql
conn.Close
Response.Redirect("protected.asp")
end if
%> Tag: Network Configuration Tag: 190080
Help with Outlook Exchange Script
I have been writing a vbscript file that queries the LDAP then
creates a .csv file with all the contact information of users in my
company. I can then go and manually create a new folder in contacts
then import the .csv into that folder, where it then organizes
everyone's information. My question is if there is a way in vbscript
to automatically create a contacts folder and import a .csv iinto the
contacts folder with vbscript? Thanks Tag: Network Configuration Tag: 190079
Mapping Network printers and loading drives with a VB Script
Hello all,
I need to be able to map a network printer but i'm using IPP so
when i type in the printer IP \\xxx.xxx.xxx.xxx\ipp I have to load the
driver from windows driver list. How can I do everything through a
script? Tag: Network Configuration Tag: 190078
Lastlogon Script help needed please....
This is a Lastlogon time/date script.
How can I make this script output to an Excel file, at the moment displays
on screen and I have to press enter each time.
********************************************
Option Explicit
Dim objRootDSE, strConfig, objConnection, objCommand, strQuery
Dim objRecordSet, objDC
Dim strDNSDomain, objShell, lngBiasKey, lngBias, k, arrstrDCs()
Dim strDN, dtmDate, objDate, lngDate, objList, strUser
Dim strBase, strFilter, strAttributes, lngHigh, lngLow
' Use a dictionary object to track latest lastLogon for each user.
Set objList = CreateObject("Scripting.Dictionary")
objList.CompareMode = vbTextCompare
' Obtain local Time Zone bias from machine registry.
Set objShell = CreateObject("Wscript.Shell")
lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\" _
& "TimeZoneInformation\ActiveTimeBias")
If UCase(TypeName(lngBiasKey)) = "LONG" Then
lngBias = lngBiasKey
ElseIf UCase(TypeName(lngBiasKey)) = "VARIANT()" Then
lngBias = 0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) * 256^k)
Next
End If
' Determine configuration context and DNS domain from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get("configurationNamingContext")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use ADO to search Active Directory for ObjectClass nTDSDSA.
' This will identify all Domain Controllers.
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strConfig & ">"
strFilter = "(objectClass=nTDSDSA)"
strAttributes = "AdsPath"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 60
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
' Enumerate parent objects of class nTDSDSA. Save Domain Controller
' AdsPaths in dynamic array arrstrDCs.
k = 0
Do Until objRecordSet.EOF
Set objDC = _
GetObject(GetObject(objRecordSet.Fields("AdsPath")).Parent)
ReDim Preserve arrstrDCs(k)
arrstrDCs(k) = objDC.DNSHostName
k = k + 1
objRecordSet.MoveNext
Loop
' Retrieve lastLogon attribute for each user on each Domain Controller.
For k = 0 To Ubound(arrstrDCs)
strBase = "<LDAP://" & arrstrDCs(k) & "/" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "distinguishedName,lastLogon"
strQuery = strBase & ";" & strFilter & ";" & strAttributes _
& ";subtree"
objCommand.CommandText = strQuery
On Error Resume Next
Set objRecordSet = objCommand.Execute
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "Domain Controller not available: " & arrstrDCs(k)
Else
On Error GoTo 0
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName")
lngDate = objRecordSet.Fields("lastLogon")
On Error Resume Next
Set objDate = lngDate
If Err.Number <> 0 Then
On Error GoTo 0
dtmDate = #1/1/1601#
Else
On Error GoTo 0
lngHigh = objDate.HighPart
lngLow = objDate.LowPart
If lngLow < 0 Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0 ) Then
dtmDate = #1/1/1601#
Else
dtmDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow)/600000000 - lngBias)/1440
End If
End If
If objList.Exists(strDN) Then
If dtmDate > objList(strDN) Then
objList(strDN) = dtmDate
End If
Else
objList.Add strDN, dtmDate
End If
objRecordSet.MoveNext
Loop
End If
Next
' Output latest lastLogon date for each user.
For Each strUser In objList
Wscript.Echo strUser & " ; " & objList(strUser)
Next
' Clean up.
objConnection.Close
Set objRootDSE = Nothing
Set objConnection = Nothing
Set objCommand = Nothing
Set objRecordSet = Nothing
Set objDC = Nothing
Set objDate = Nothing
Set objList = Nothing
Set objShell = Nothing
********************************************************** Tag: Network Configuration Tag: 190071
WshShell.Run - Spaces in path
Hi
I would like to run Internet Explorer from a VBScript.
The path to "iexplore.exe" is "C:\Program Files\Internet
Explorer\iexplore.exe".
When I try to run it it fails saying that "The system cannot find the file
specified.".
After some research I found out that the script can't deal with the spaces
in the program path.
Any ideas how to work around this?
Regards
Wayne Tag: Network Configuration Tag: 190070
Scheduled disabling of modem
I have a Windows 2000 Professional SP4 PC with a modem and network card. I
use the modem to perform a scheduled download each day between 10:00 and
11:00. While the modem is active I want to disable the NIC. Similarly, I want
to re-enable the NIC and disable the modem when the scheduled download is
finished. Can this be done through VBScript? Tag: Network Configuration Tag: 190069
Event log Message display
I have put together a script that pulls error events from all of our serverâ??s
event logs to a comma delimited CVS file. Nothing to fancy.
I do have a small setback with some messages that have some information is
in quotations.
Using Event Viewer the message is displayed as
DCOM got error "General access denied errorâ?? from the computer EEWHQ when
attempting to activate the server:
WScript.Echo objItem.Message displays
DCOM got error "%2147942405" from the computer EEWHQ when attempting to
activate the server :{8E980A48-BED6-46FC-ABA2-B21A9A381A2A},
This is also true of code coming out of SCRIPTOMATIC. I imagine itâ??s a
reference to a look up table.
Anybody know if this is true and how to access the information.
Thanks Tag: Network Configuration Tag: 190068
New to scripting... bulk user creation.
Hi,
I am trying to write a script that should do the following: create a
given number og users with a standard password, their accounts enabled
and the "change password at logon" flag un-checked. This is what I've
got so far
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://OU=Application,OU=Testers,OU=Test
Users," & _
objRootDSE.Get("defaultNamingContext"))
For i = 1 To 3
Set objLeaf = objContainer.Create("User", "cn=MT" & 1020 ++ i)
objLeaf.Put "sAMAccountName", "MT" & 1020 ++ i
objLeaf.SetInfo
Set objUser = GetObject("LDAP://cn=" & objLeaf & "," &
objContainer)
objUser.SetPassword "Start123"
Next
As far as I can figure it creates the first user and then something
goes wrong. If I remove the password bit it works. Useres are created
in the right OUs
Help please?
Alex. Tag: Network Configuration Tag: 190066
Delete some subkeys in the registry
Hi
I have the problem, that if I make a connection to a ftp server via
microsoft explorer or internet explorer, the system stores the last
logon informations. If I navigate to an other server, the explorer tries
automaticaly log on with the previous logon informations.
Now I will make a script wich delete this logon information in the
registry HKCU\Software\Microsoft\FTP\Accounts
Here is my example but I think that the EnumKey Method is not the right
on for this script. Maybe anyone has a better solution, please help
Thanks
Peter
const HKCU = &H80000001 'HKEY CURRENT USER
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Ftp\Accounts"
objReg.EnumKey HKCU, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
Return = objReg.DeleteKey(HKCU, strKeyPath & "\" & subkey)
MsggBox HKCU & strKeyPath & "\" & subkey
If (Return = 0) And (Err.Number = 0) Then
Wscript.Echo "HKCU\Software\Microsoft\Ftp\Accounts\" &
subkey & " deleted"
Else
Wscript.Echo "DeleteKey " & subkey & " failed. Error = "
& Err.Number
End If
Next Tag: Network Configuration Tag: 190065
Launch CMD.exe from HTA using VBScript
Hi,
Is it possible to launch CMD.EXE from an HTA using vbscript.
I have put in a link which runs a subroutine which calls wshshell.run
"c:\winnt\system32\cmd.exe" using VBscript but when I click on the link
in an HTA it does not seem to do anything.
I have put in a msgbox in the sub to test this and this appears fine.
I tried putting this in the link itself but it just opens cmd.exe in
the same hta window with all the executable code.
Is it possible to launch CMD from a HTA at all ?
Many thanks
TW Tag: Network Configuration Tag: 190064
Simulate (fake) drag/drop + button click behavior using VBScript
Hi all,
I would like to write a script to automate some task, but this task requires the use of a GUI based application that can only use its GUI for input (so no command line parameters). This GUI application is not mine, and I cannot change it in any way. Let's call this GUI application GUIAPP.
The script would go over a list of files (this I can do myself :-), and for every file, the following should happen
1) have the script fake a drag and drop of this file on the GUIAPP (so that it accepts the file as input)
2) the script has to click the ok button; this button triggers a "Save As..." window
4) the script should fill in some string of my choice for the file name
5) the script should click the "Save" button
This must be possible using OLE, I would think?
Help would really be appreciated!
Stefaan Tag: Network Configuration Tag: 190063
We are getting ScriptTimeout error while trying to retrieve a ASP
Earlier this page works fine. The code is in ASP and the backend is Oracle9i.
We are using MSDAORA.1 driver to connect to database. we just upgraded from
Oracle8i to Oralce9i. we haven't changed any thing inthe code for this
migration. We don't want to set Server.ScriptTimeOut to some big value.
Instead we need a good solution to increase the performance of the page. we
are getting error even if the page has no much data to retrieve from the
database. code has simple queries and some loops to generate data. we are not
using stored procs. In the DEV eveything is working fine. But in Production
we have this performance issue. Can you please suggest is it problem with
driver, if then suggest better driver ?Appreciate your help. TIA. Tag: Network Configuration Tag: 190059
Software Inventory script help
I have a VB script that writes a list of installed applications to a text
file that is named the computername.
It works okay except that it does not list the user, so it is difficult and
time consuming to find which users are assigned to those computers.
Can someone help me and show what needs to be added (and where) for the
script to also write the name of at least the currently logged on user?
Ideally, it would also write the list of all the domain user profiles on
that computer (or the domain user profiles on that computer that have been
used in the last 30 days).
Here is the script that lacks that added functionality:
on error resume next
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("\\server\folder\folder\inv\" &
strcomputer & ".txt", True)
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
For Each strSubkey In arrSubkeys
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
objTextFile.WriteLine strValue1 & "¿ " & strcomputer & "¿"
End If
Next
strKey2 =
"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry2a = "DisplayName"
strEntry2b = "QuietDisplayName"
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey2, arrSubkeys
For Each strSubkey In arrSubkeys
intRet2 = objReg.GetStringValue(HKLM, strKey2 & strSubkey, _
strEntry2a, strValue2)
If intRet2 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2b, strValue2
End If
If strValue2 <> "" Then
objTextFile.WriteLine strValue2 & "¿ " & strcomputer & "¿"
End If
Next
objTextFile.Close Tag: Network Configuration Tag: 190054
create exchange mailbox for existing user account.
I'm trying to create a mailbox for an existing user account. I just
need to know what are the different types of properties in vbscript that
is attached to the mailbox account properties so I can create them.
Can't seem to be able to find them anywhere on google. Tag: Network Configuration Tag: 190052
Exec with Alternate Credentials - How?
Hi ALL,
I need to start a proces on a remote computer like in the sample below
(starts "Calc.exe"). However, I am clueless on how to provide alternate
credentials for that. How can I pass the proper user/password?
Thanks in advance!
strComputer = "."
strExe = "Calc.exe"
' Connect to WMI
set objWMIService = getobject("winmgmts://"& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe Tag: Network Configuration Tag: 190047
get attachment from outlook email and save to a file with new name
Hi all. Due to a short sighted process that I did not design, I get a
single text file everyday that has the same name called "daily.txt." So
I have like a three-hundred of these emails, and I would like to use a
script to save them from email to a file on my harddrive, preferably
with a name thats based on the date that email attachment was received.
If that date thing is not possible, I would be happy just to get the
files saved off with a unique name for each.
Any one help? Tag: Network Configuration Tag: 190042
Last logon date for users...
Can anyone please help me out. I've noticed a fair amount of VBScripts
created for Domain Controllers, but I'm trying to quey a Windows 2000 and
2003 workgroup server (non Domain) for all the users and last logon date...
Can anyone please help me?
TIA...Your help is appreicated! Tag: Network Configuration Tag: 190039
Import data file & update with SQL
I would like to be able to use a vbs script to
1) import a text file of a known, specific format into a table
2) Delete records that match a criteria (a delete SQL?)
3) Save to a new file.
Any pointers? or suggestions?
This does not have to be a DB/table solution, but I am an ACCESS
programmer with very basic vbs specific knowledge. Would like this to
be a simple drag and drop operation for the end user if possible.
What specific info do I need to supply to have an intelligent answer?
TIA
- Z Tag: Network Configuration Tag: 190037
vbscript to identify and restart hanging services.
I have written a script that restarts services that have stopped, that
are set to auto start. The problem I'm having is that hanging services
don't get identified, and therefore remain in a hung state. Is there a
way using VBscript to identify a hung service?
Thanks, any help is greatly appreciated,
Josh Tag: Network Configuration Tag: 190036
Scan AD Computers for text file
Our users have a flag file at the root of their profiles
(C:\Docume~1\%USERNAME%), based on whether or not they received our printer
migration logon script. I'd like to scan all of these computers to see who
has the flag file, but I've never used VB to pull names of computers from AD
before.
Does anybody have a generic canned script that will pull names of computers
from AD to check for a file on each computer?
Thanks for any help or suggestions! Tag: Network Configuration Tag: 190034
RegRead Method for Newbie's
Hi
I would like to read few keys under a specific key and then delete it
but I didn't find a way to do this with the regread method.
Did you know a way to do this ?
Thanks
Peter Tag: Network Configuration Tag: 190027
Hello guys!!!
Is there a way to get the speed configured on the network adapters using
VBScripts?