extracting the info from quotes!!
Hi,
Is there a straight forward way to extract the information within
quotes only. There could be differnet types of values within quotes
and so is there a way to extract these.
Thanks ,
Sa
..TopCell "CAP_SMD_2512_.250X.130B_.043HT" Tag: config dcom settings Tag: 217752
Group lookup problem
I have an old script I use to verify what groups a user is in and then run
scripts based on thoughs groups. This script run perfectly fine on my current
domain/forest with all users.
However when I created a new domain/forest for a sub company that is braking
off from us the script no longer works.
The funny part is that for Domain admins it works fine but not for a regluar
user. I think it is some permission change in AD and would like to know what
I have to change to get this to work.
Here is the part of the script I use to vailadate groups:
' Check For Group Messages and Mappings
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &ADSysInfo.UserName)
arrMemberOf = CurrentUser.MemberOf
For each Group in arrMemberOf
Group = Mid(Group,4)
intLeft = Instr(Group,",") - 1
Group = Left(Group, intLeft)
'WScript.Echo Group
' Check for a message for each Group
Messagepath = Scrpath & "\" & Group & ".txt"
'WScript.Echo Messagepath
If (fso.FileExists(Messagepath)) Then
Set f = fso.OpenTextFile(Messagepath, ForReading, True)
temp = WShShell.Popup(f.Readall,30,ExtremeM, 0 + 48)
End If
' Chech for a Script for each Group
Scriptpath = Scrpath & "\" & Group & ".VBS"
'WScript.Echo Scriptpath
If (fso.FileExists(Scriptpath)) Then
Temp = WshShell.Run(Scriptpath ,1 , True)
End If
Next Tag: config dcom settings Tag: 217751
Needing replacing a backslash by a comma
Hello,
I just need to know how to find the third backslash in a string like this:
\\192.168.1.2\SYSVOL
It is like it was really \\anything\anything
and then replace it by a comma so that the string can be like:
\\192.168.1.2,SYSVOL
I have been trying with regular expressions but unsuccessfully.
Any ideas?
Thank you! Tag: config dcom settings Tag: 217746
Screen Saver - Execute
Is there a way to execute the user's screen saver using vbscript?
Microsoft had a button in an old version of office (office 97?) that had a
window shade icon on the quicklaunch toolbar which executed the screen saver
- i would like to emulate that functionality.
thanks Tag: config dcom settings Tag: 217740
Authenticated SMB Access
Hi there,
I'm developing an app that reads a plain text file from a remote AS400-
IFS Service (samba-like stuff I guess). The problem is that this
access is not allowed without authentication, and I cannot
authenticate the access from within my app (it's written in a very old
programming language and I cannot change :( ). I was wondering if it's
there any way to run my app from within an vbscript but call the app
just after I have authenticated into the IFS service.
There should be no difference from authenticating with a Windows-
running machine, it should be like accessing a password protected
shared folder on a remote Windows 2003 Server, for instance.
Thanks in advance.
A. Stukov. Tag: config dcom settings Tag: 217737
Encrypting data in vbscript
Hi,
I have to encrypt some data using an encryption algorithm like TrippleDES or
AES in VBScript. After searching I found that two system32 dlls "advadpi.dll"
and "crypt32.dll" provides this functionality. But it seems these dlls are
not COM dlls. Hence I am unable to use these dlls in vbscript.
I have two questions here:
1. Please some one let me know whether I am reffering correct dlls or not to
encrypt data in vbscript.
2. And if I am referring to the correct dlls then please put some light on
how to use these dlls in vbscript.
Thanks in advance.
Regards, Tag: config dcom settings Tag: 217735
elevate script permission for vista uac
Any tips on how to get around UAC for scripts requiring major system
changes such as WMI workstation rename. Can you elevate the permission
so the user gets no messages.
Or is turning of UAC the ultimate solution ?
If it wasn't for the restart it can be turned on and off with no problem. Tag: config dcom settings Tag: 217733
Failing to map remote drive.
Have a look at code i m having problem with.
arrComputers = Array("comp1","comp2","comp3","comp4","comp5")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strServer, _
"root\cimv2", _
strUser, _
strPassword, _
"MS_409", _
"ntlmdomain:" + strDomain)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_LogicalDisk instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Size: " & objItem.Size
Next
Next
Here Comp2, Comp 3 are in domain1. and Comp 1,4 &5 are in domain2.
When i run the script form Domain 2, It gets me data for Comp 1 but i get
error: Access is denied for rest of the list. Actually it should get data for
Comp4 and 5 but its not. Same when i run from Domain 1 it gives same error
where it should get data form Comp 2 & 3.
I tried to Set ColItems = Nothing but thts also not helping. Plz suggest Tag: config dcom settings Tag: 217731
In VB Find First Available Unassigned Drive Letter
Is there a quick and easy code in VB that will allow me to scan and
find the first unassigned Drive Letter?
I need to use the SUBST command and want to apply it to an unassigned
(available/free) drive letter that currently isn't in use. Tag: config dcom settings Tag: 217727
Failed to start a program by script
Hi,
I used the following script lines to start a program by a schedule batch
program:
Dim AppCmd
Set AppCmd = "start /d c:\rdata c:\swapplic\chsp\bin\dldbridge.exe"
Dim oProcesses, ErrResult, iID
Set oProcess = GetObject("winmgmts:\\" & sName &
"\root\cimv2:Win32_Process")
ErrResult =
oProcess.Create(WScript.Arguments.Named("AppCmd"),Null,Null,iID)
However, the script failed with ErrResult=8.
I recently increase the memory from 1G to 2G and sill have 10G free space in
hard disk. What is going wrong? Please Help!
--
Andy Mar Tag: config dcom settings Tag: 217726
RE:regular expressions using not !!
Hi,
I have a regular expression such as:
"[a-z]+[0-9]+" So this basically includes all alphabeths followed by
numbers but I do not want "mll" followed by numbers.
I am using this in an if statement. Is it possible to set a pattern
for something like this maybe by using a ^ or a not ??
Thanks
SA Tag: config dcom settings Tag: 217725
adding a line to .ini file
Hello Scripters,
I have found a good reading on how to edit a .ini file but what I wanted to
do instead of editing the .ini File, I would like to add a line via
scripting. Help! I need a script that can add line on a .ini file.
Thanks,
GP Tag: config dcom settings Tag: 217722
A REG QUERY that does not return "ERROR" when key not found
My loginscript checks for presence of keys under HKCU.
E.g. reg query HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
However reg query still returns ERROR: The system was unable to find the specified registry key or value.
So what do I do? I wonder if there is a vbscript that can behave like reg query?
e.g. cscript RegQuery.vbs HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
EXCEPT not displaying ERROR ?
Any help would greatly be appreciated.
--
-- HAL07, Engineering Services, Norway Tag: config dcom settings Tag: 217716
ADSI scripting question
I have a script that will pull the list of groups that have access to a
folder that is
specified in a message box.
I also have each group outputting to a seperate worksheet in an Excel
spreadsheet. The list of users in these groups are outputting in this form
(CN=smith\,joe L,OU=Users,OU=Default,DC=test, DC=com). I want to just output
Joe Smith, jsmith. When I change arrUsers =
ObjRecordset.Fileds("member").Vaule to DistinguishedName or DisplayName or
anything else I get nothing in these fields. I think it has to do with
querying the "group" instead of the user category but am not sure if I am
right or how to add a second query based on the results of the groups I
pulled in the previous query.
Can anyone advise on how this can be done? Script is copied below. Thank you.
Dim objCommand, objConnection, strBase, strFilter, strAttributes
Dim strQuery, objRecordset, strName, strCN
Dim excelgroups, objExcel, objWshNet, strFoldername, UNCPathName, DrvLetter,
strComputerName
Set objExcel = CreateObject("Excel.Application")
On Error resume Next
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(2, 1).Value = "Login\Group Name"
objExcel.Cells(2, 1).Font.Bold = TRUE
objExcel.Cells(2, 2).Value = "Access Allowed\Denied"
objExcel.Cells(2, 2).Font.Bold = TRUE
objExcel.Cells(2, 3).Value = "Permission Assigned"
objExcel.Cells(2, 3).Font.Bold = TRUE
objExcel.WorkSheets(1).name = "Permissions List"
UNCPathName = InputBox("please supply the UNC path to the shared folder")
DrvLetter = InputBox("Please supply unused driver letter followed by a colon")
set objWshNet = WScript.CreateObject("Wscript.Network")
objWshNet.MapNetworkDrive DrvLetter, UNCPathName
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 0"
End If
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 1"
End If
objExcel.Cells(1, 1).Value = UNCPathName
SE_DACL_PRESENT = &h4
ACCESS_ALLOWED_ACE_TYPE = &h0
ACCESS_DENIED_ACE_TYPE = &h1
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 2"
End If
Set objWMIService = GetObject("winmgmts:")
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 3"
End If
Set objFolderSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting.path='" & DrvLetter &
"\'")
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 4"
End If
intRetVal = objFolderSecuritySettings.GetSecurityDescriptor(objSD)
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Number & vbcrlf &_
Err.Description & " 5"
End If
intControlFlags = objSD.ControlFlags
If intControlFlags AND SE_DACL_PRESENT Then
arrACEs = objSD.DACL
X=3
For Each objACE in arrACEs
objExcel.Cells(x, 1).Value = _
objACE.Trustee.Domain & "\" & objACE.Trustee.Name
If objACE.AceType = ACCESS_ALLOWED_ACE_TYPE Then
objExcel.Cells(x, 2).Value = _
vbTab & "Allowed:"
ElseIf objACE.AceType = ACCESS_DENIED_ACE_TYPE Then
objExcel.Cells(x, 2).Value = _
vbTab & "Denied:"
End If
If objACE.AccessMask = "1245631" Then
objExcel.Cells(x, 3).Value = "Modify"
End If
If objACE.AccessMask = "1179785" Then
objExcel.Cells(x, 3).Value = "Read Only"
End If
If objACE.AccessMask = "1179817" Then
objExcel.Cells(x, 3).Value = "Read & Execute"
End If
If objACE.AccessMask = "2032127" Then
objExcel.Cells(x, 3).Value = "Full Control"
End If
X=X+1
Next
Else
WScript.Echo "No DACL present in security descriptor"
End If
Set objRange = objExcel.Range("A1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("B1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("A1").SpecialCells(11)
Set objRange2 = objExcel.Range("C1")
Set objRange3 = objExcel.Range("A1")
x=2
Do Until objExcel.Cells(x,1).Value = ""
arrSecCon= Split(objExcel.Cells(x,1).Value, "\")
CellValue=arrSecCon(1)
objExcel.Cells(x,1).Value=CellValue
x=x+1
loop
w=2
x=2
Do Until objExcel.Worksheets(1).Cells(x,1).Value = ""
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://dc=test,dc=company,dc=corp,dc=com>"
strFilter = "(&(objectCategory=group)(cn=" &
objExcel.Worksheets(1).Cells(x,1).Value & "))"
strAttributes = "sAMAccountName,cn,member,objectClass"
strQuery = strBase & ";" & strFilter & ";" & strAttributes &
";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objExcel.Worksheets(1).cells(x,
2).value=objRecordSet.Fields("objectCategory").Value
If objRecordSet.Fields("objectClass").Value = "Top;group" Then
Do Until objRecordSet.EOF
MbrName = objRecordSet.Fields("sAMAccountName").Value
Wscript.echo "Beginning of enumeration of group " & MbrName
y=2
arrUsers = objRecordSet.Fields("member").Value
If IsNull(arrUsers) Then
Wscript.Echo "-- No users assigned to group"
Else
If w>=4 Then
objExcel.worksheets.Add
objExcel.WorkSheets(w).move objExcel.WorkSheets(w-1)
End If
objExcel.WorkSheets(w).Activate
objExcel.WorkSheets(w).Cells(1, 1).Value = MbrName
For Each strUser In arrUsers
If objRecordSet.Fields("objectClass").Value = "Top;group" Then
objExcel.WorkSheets(w).cells(y,1).value=strUser
y=y+1
End If
Next
End If
objRecordSet.MoveNext
objExcel.WorkSheets(w).name = MbrName
w=W+1
Loop
End IF
x=x+1
loop
objWshNet.removenetworkdrive DrvLetter, True, True
objConnection.Close
wscript.quit Tag: config dcom settings Tag: 217706
find account number in excel files
I am looking for a script to find only "account Number" in some excel files.
I tried to use simply bat file such as
Find /C "ACCOUNT NUMBER" "D:\data\ *.* "d:\find.txt"
First it didn't work and find 0
second it gets access denied on the network drive even at local server which
the drives sits.
Any input is welcome and appreciated!
G Tag: config dcom settings Tag: 217703
Find PST file and give path and size
I want to run the script from any computer and go to the path and search for
any pst.
strPath = "\\lmdatastore\data01\users\"
strUserName = "wperez"
strExtension = "pst"
Set objWMIService = GetObject("winmgmts:" _ <---- error in this block
& "{impersonationLevel=impersonate}!\\" _
& strPath & "\root\cimv2") ----> error in
this block
Set colItems = objWMIService. _
ExecQuery("Select * From Cim_DataFile " _
& "Where (Path = '" & strPath & "' & '" & strUserName & "' & And
Extension='" & strExtension & "'")
'
WScript.Echo "# of files found: " & colItems.Count
For Each objItem In colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "CIM_DataFile instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "FileName: " & objItem.Name
WScript.Echo "FileSize (bytes): " & objItem.FileSize
WScript.Echo strpath & strUserName
Next
I am getting an error:
(18, 1) (null): 0x80041021 Tag: config dcom settings Tag: 217699
Problem Passing Parameter to Web Method with VBScript
I am using VBScript to access a remote database server via a web service. I
am trying to call a web method that hits a database and runs the query I pass
in as a parameter and returns the results. However, I am being returned an
error that says the CommandText property has not been initialized. I
researched the error, and I discovered that my sqlQuery parameter is not
reaching the web service, so the service is trying to execute a blank
command, which throws the error. I thought I was properly forming my SOAP
command to pass the parameter, but maybe I am not. Here is the VBScript code
to form the SOAP command and send it:
Dim strSoapAction
Dim strUrl
Dim strXml
Dim strParam
Dim xmlDOC
Set xmlDOC = CreateObject("MSXML2.DOMDocument.6.0")
strParam = "SELECT KeyField, DataField FROM TestTable WHERE StatusField =
'Bad'"
strUrl = "http://localhost/MOM_POC_DummyService/DataService.asmx"
strSoapAction = "http://tempuri.org/GetDBData"
strXml = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soap:Body>" & _
"<CheckActCode xmlns=""http://tempuri.org/"">" & _
"<actCode>" & strParam & "</actCode>" & _
"</CheckActCode>" & _
"</soap:Body>" & _
"</soap:Envelope>"
xmlDOC.loadXML(PostWebservice(strUrl, strSoapAction, strXml))
And here is the PostWebService function:
Function PostWebservice(AsmxUrl, SoapActionUrl, XmlBody)
Dim objDom
Dim objXmlHttp
' Create objects to DOMDocument and XMLHTTP
Set objDom = CreateObject("MSXML2.DOMDocument")
Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
' Load XML
objDom.async = False
objDom.loadXML XmlBody
' Open the webservice
objXmlHttp.open "POST", AsmxUrl, False
' Create headings
objXmlHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXmlHttp.setRequestHeader "SOAPAction", SoapActionUrl
' Send XML command
objXmlHttp.send objDom.xml
PostWebservice = objXmlHttp.responseXml.xml
End Function
This code works and returns data when I call web methods that do not require
passed parameters, but this web method requires a single parameter (string
sqlQuery).
Any help would be greatly appreciated as to what I am doing wrong.
Thanks in advance Tag: config dcom settings Tag: 217698
scheduleing a DOS program
Hi,
I like to schedule a DOS program to be executed and during the executing
time, it will take a predefined input and direct the output to a file.
basically, the DOS program is SQLIO, downloadable from Microsoft. I
following its document to do the series of ios
sqlio -kW -s10 -frandom -o8 -b8 -LS -Fparam.txt
timeout /T 60 > c:\out.log
sqlio -kW -s360 -frandom -o8 -b64 -LS -Fparam.txt
timeout /T 60
>> c:\out.log
but, it won't complete. the c:\out.log was created. there is nothing in
there. neither was it seemed executing sqlio at all.
is there special command to DOS program in general to redirect output to a
file?
thanks. Tag: config dcom settings Tag: 217693
Script Host Error
I am trying to run this script:
Const CONVERSION_FACTOR = 1048576
Computer = "IT-Admin"
Set objWMIService = GetObject ("winmgmts://" & Computer)
Set colLogicalDisk = objWMIService.InstancesOf ("Win32_LogicalDisk.")
For Each objLogicalDisk In colLogicalDisk
FreeMegaBytes = objLogicalDisk.FreeSpace / CONVERSION_FACTOR
Wscript.Echo objLogicalDisk.DeviceID & " " & Int(FreeMegaBytes)
Next
Whenever I run it I get this error:
Script: {path to script}
Line: 5
Char: 1
Error: 0x80041010
Code: 80041010
Source: (null)
Can anyone tell me what this means and what I am doing wrong. Tag: config dcom settings Tag: 217691
Vista Stratup Script
Hi,
I have a question:
I had a GPO statup script for creating some registry key under HQLocal
Machine for XP. It's works fine under Windows XP but under Windwos Vista the
startup script doesn't works.
If I make a GP Result, I see that the GPO is applied.
If I thest to launch the scipt under a user session(with the right to write
into the registry) it works fine.
How have a solution ? Tag: config dcom settings Tag: 217681
Vb Script to change Account lockout threshold
Hello:
I am looking for a way to change the Account Policy->Account Lockout
Policy->Account lockout threshold through a vbscript or command line.
I am wanting to run this script on a computer in a workgroup, NOT a domain.
Thanks Tag: config dcom settings Tag: 217677
Copy XML from HTTP URL to hard disk?
Hi all.
In this URL is the SDN.xml file
http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml
I need to automatically copy the file to hard disk.
Thanks for your help. Tag: config dcom settings Tag: 217674
Closes Outlook using VBS script
Hi,
I am looking for a simple script that will close Outlook 2003 in an elegant
fashion rather than killing the outlook.exe process.
I have in the past used a script but I see that wscipt.exe hangs at 50% as
if the script caonnt complete.
on error resume next
Set objOutlook = GetObject(, "Outlook.Application")
do while ObjOutlook.Inspectors.Count <> 0
For Each objInspector In objOutlook.Inspectors
objInspector.CurrentItem.Save
objInspector.Close True
Next
loop
objOutlook.quit
Can anyone let me know if they have a script that works all the time without
wscript.exe hanging at all?
Thank you
Oli Tag: config dcom settings Tag: 217665
Sending mail using cdosys and a html template
Hi there,
I want to sent form values in a HTML-mail using CDOsys and a HTML-
template. The 'placeholders' in the template should be filled with the
values from the form.
Does anyone knows how to do this and has some sample code for me?
Thanks! Tag: config dcom settings Tag: 217664
Error on 64 bit systems...
Hello,
I'm trying the following script on 32 bit remote servers and it is
working great. However, as soon as I use this same script to run on 64
bit systems, it gives me the errors mentioned after the script below:
'On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strServer = InputBox("Enter Server Name here: ")
strServer = Trim(strServer)
If IsEmpty(strServer) Then
WScript.Echo "You have to enter a valid Server Name...ending Script"
ElseIf Len(strServer) = 0 Then
WScript.Echo "You have to enter a valid Server Name...ending Script"
Else
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strServer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager
\Environment"
strValueName = "PROCESSOR_ARCHITECTURE"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,
strValue
If strValue = "x86" Then
WScript.Echo "32 bit OS"
Else
WScript.Echo "64 bit OS"
End If
End If
Error:
C:\BT\Scripts\2003SP2Auto\32or64.vbs(19, 1) Microsoft VBScript runtime
error: Th
e remote server machine does not exist or is unavailable: 'GetObject'
Note: I'm trying to run the above script from a 2003 SP2 32-bit server
and entering a remote 64-bit server name at the prompt.
Please help ! Tag: config dcom settings Tag: 217657
If "HKEY_CURRENT_USER\Software\Microsoft\Communicator\Transport" e
I'm trying to create a script that checks if the following key exist on
users' pc:
HKEY_CURRENT_USER\Software\Microsoft\Communicator\Transport
If exist, exit the script, if not exist create the key as following:
WSHShell.RegWrite
"HKEY_CURRENT_USER\Software\Microsoft\Communicator\Transport", 1, "REG_DWORD"
I cannot get this to work. Thank you for any help. Tag: config dcom settings Tag: 217656
Find PST On both c:\ and u:\
strComputer = "." ' use "." for local computer
strDrive = "c:"
strExtension = "pst"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService. _
ExecQuery("Select Name from CIM_DataFile" _
& " where Drive ='C:' and Extension='pst'")
'& " where '" & strDrive & "' & '" & strExtension & "'") - I would like
to use this but it will not work
'WScript.Echo "# of files found: " & colItems.Count
For Each objItem In colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "CIM_DataFile instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "FileName: " & objItem.Name
WScript.Echo "FileSize: " & objItem.size - I can not get the file saize
Next
Error - U:\Scripts\FindPST.vbs(33, 5) Microsoft VBScript runtime error:
Object doesn't support this property or method: 'objItem.size'
Please help Tag: config dcom settings Tag: 217652
BrosweForFolder method erroring out
I have a very simple script that is crashing on me with an error code
80004005. I am running the script on a Windows Vista machine from the my
documents folder with a standard user account
here is the code snippet
SET objShell = WScript.CREATEOBJECT("SHELL.Application")
SET objFolder = objShell.BrowseForFolder(0,"Select a File", &H4000,
strpath)
I can browse to and select the file I need, the crash occurs once the file
is selected and points to the SET objFolder line.
Thanks for any help you can provide. Tag: config dcom settings Tag: 217645
Create function in dll - New to VB world
Hi folks,
I am totally new to VB. I would like to create a function in dll (VB6)
which can be called by MS Access and Excel. Please guide me step by step to
create it.
Public function TotalSale(quantity as integer, cost as integer) as integer
TotalSale = quantity*cost*1.3
End function
Thanks in advance.
Tim. Tag: config dcom settings Tag: 217643
return security access for a folder - DACL
I am trying to write a script that will first list the security groups on a
folder and their level of access - for example Admisitrators - Allowed - Full
Control. Eventually I will want to output the users within these groups also.
I am stuck in the first step. When i run the below script it always returns
"No DACL present in security descriptor". For some reason it is not
connecting and reading the folder i specify in strFolderName. I copied the
beginning of the script below. Any help with identifying what is wrong is
appreciated.
Set objExcel = CreateObject("Excel.Application")
On Error resume Next
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(2, 1).Value = "Login\Group Name"
objExcel.Cells(2, 1).Font.Bold = TRUE
objExcel.Cells(2, 2).Value = "Access Allowed\Denied"
objExcel.Cells(2, 2).Font.Bold = TRUE
objExcel.Cells(2, 3).Value = "Permission Assigned"
objExcel.Cells(2, 3).Font.Bold = TRUE
objExcel.WorkSheets(1).name = "Permissions List"
strFolderName = "c:\scripts"
objExcel.Cells(1, 1).Value = strFolderName
SE_DACL_PRESENT = &h4
ACCESS_ALLOWED_ACE_TYPE = &h0
ACCESS_DENIED_ACE_TYPE = &h1
'Set objWMIService = GetObject("winmgmts:")
Set objWMIService = GetObject("winmgmts:\\" & strFolderName & "\root\cimv2")
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFolderName & "'")
intRetVal = objFolderSecuritySettings.GetSecurityDescriptor(objSD)
intControlFlags = objSD.ControlFlags
If intControlFlags AND SE_DACL_PRESENT Then
arrACEs = objSD.DACL
X=3
For Each objACE in arrACEs
objExcel.Cells(x, 1).Value = _
objACE.Trustee.Domain & "\" & objACE.Trustee.Name
If objACE.AceType = ACCESS_ALLOWED_ACE_TYPE Then
objExcel.Cells(x, 2).Value = _
vbTab & "Allowed:"
ElseIf objACE.AceType = ACCESS_DENIED_ACE_TYPE Then
objExcel.Cells(x, 2).Value = _
vbTab & "Denied:"
End If
If objACE.AccessMask = "1245631" Then
objExcel.Cells(x, 3).Value = "Modify"
End If
If objACE.AccessMask = "1179785" Then
objExcel.Cells(x, 3).Value = "Read Only"
End If
If objACE.AccessMask = "1179817" Then
objExcel.Cells(x, 3).Value = "Read & Execute"
End If
If objACE.AccessMask = "2032127" Then
objExcel.Cells(x, 3).Value = "Full Control"
End If
X=X+1
Next
Else
WScript.Echo "No DACL present in security descriptor"
End If Tag: config dcom settings Tag: 217633
Save script output to a text file
I wrote a script to pull printer name, serial number and page counts from our
printers. How can I save the results to a text file?
This is the script:
Model = "mib-2.43.5.1.1.16.1"
SerialNumber = "mib-2.43.5.1.1.17.1"
PageCount = "mib-2.43.10.2.1.4.1.1"
Host = "C:\testhost.txt"
Set objfso = CreateObject("Scripting.FileSystemObject")
Set exec = CreateObject("WScript.Shell")
Set hostw = objfso.OpenTextFile(host, 1, True)
Do Until hostw.AtEndOfStream
r = hostw.ReadLine
WScript.Echo "start here"
WScript.Echo r
Set Loger = exec.Exec("snmpwalk -v 1 -c public " & r & " " & Model)
b = Loger.stdout.readall
WScript.Echo Replace(b, "SNMPv2-SMI:: = STRING: "& Model,"")
Set Loger2 = exec.Exec("snmpwalk -v 1 -c public " & r & " " & SerialNumber)
b2 = Loger2.stdout.readall
WScript.Echo Replace(b2, "SNMPv2-SMI:: = STRING: "& SerialNumber,"")
Set Loger3 = exec.Exec("snmpwalk -v 1 -c public " & r & " " & PageCount)
b3 = Loger3.stdout.readall
WScript.Echo Replace(b3, "SNMPv2-SMI:: = counter32: "& PageCount,"")
Loop Tag: config dcom settings Tag: 217632
script to map tcp/ip printer
I'm looking for a script that will map a printer based on ip address and also
will assign it the generic laserjet 5 driver.
For example if the print server goes down, a script to execute that will add
the port number ip_192.168.1.x using the laserjet 5 print driver and possibly
setting it as the default.
Any ideas? This needs to work on XP and Windows 2000 pcs. If this can be
done via batch file, let me know.
Thanks. Tag: config dcom settings Tag: 217631
Re: framing a smarter search string in vbScript
Hi,
Is there a way to search for multiple strings in a text document. I am
looking for 5 alphabets (which can be upper or lower) or numbers etc
and am using instr to do that. IT makes for a very long code. Is there
a smarter way to use instr( textstring, search string) where it will
let me search for more than 1 thing a time incl upper and lower
For each desc in descol
if level = 0 then
objFileW.Write "Name:" & desc
elseif level=1 and (instr(desc,"k", 1) or instr(desc,"M",1 or
inst(desc, "K",1) ......... then
SA Tag: config dcom settings Tag: 217625
Win32_PingStatus on Vista (works on XP)
I've nearly completed an HTA that uses the Win32_PingStatus to verify if a
computer is up and running. If so it uses additional WMI to gather the
computer name, logged on user and domain. Once that's is done it offers 4
options - Computer Management, Remote Assistance, Remote Desktop and
connecting to c$. Very nice and almost done if it weren't for Vista.
The code below (with the On Error disabled) errors at "For" with "Could not
completed the operation due to error 80041001" but only when a number is
enter that is smaller than 1677216 (which equates to 0.255.255.255. If the
number enter is 1677216 (which equates to 1.0.0.0) then it will work
properly. The problem is that it will work properly with both computer names
and IP addresses and it is possible to name a computer, 45. I've tried
checking the valued entered for a "." to make sure it's not an IP address and
then using CStr so Vista won't treat it as number. This still doesn't work!
Any ideas how to circumvent this problem? By the way, the onload checks the
versions of Windows so I have the option to code using that and in some other
places I do.
-----------------------------------
Set objPing =
GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & strCPU & "'")
'On Error Resume Next
For Each objStatus in objPing...
----------------------------------- Tag: config dcom settings Tag: 217623
Domain connection detection
I would like to get a consensus from the group on the best / preferred
method for detecting a connection to the domain for which a computer is a
member of.
I am going to write a script that runs at startup for laptop users that
will check for a connection to the domain and exit if present. If not
present, it will sit in an endless loop watching for a connection and then
perform some tasks (map drives, check password expiration, etc) upon
connection. I am considering pinging a known server. I am also considering
using 'Scripting.FileSystemObject's' 'FolderExists' method to check for the
DFS root. Which of these two methods would be the preferred method and are
there other, better methods? Tag: config dcom settings Tag: 217621
Connection to a domain from a client in workgroup
Hi,
my situation is:
- Windows domain 2003 R2 with few clients XP Prof Sp2
- few clients XP Prof SP2 in workgroup
I need to create a vbs script that it is able to connect to the domain from
a client that resides in the workgruop. So, I suppose that the script must
contain the necessary information to connect to the specific domain. And when
the connection is established, the script must read some user properties and
the make some operation in the client.
How can achieve this goal?
Thanks.
Fr. Tag: config dcom settings Tag: 217620
weekdayname after installation of XP Sp3
i have a vbs to write day name (Monay, Tuesday....)
However, after installation of XP sp3, the weekdayname change to Chinese
format weekdayname, not english "Monday..."
how can i do? Thanks a lot.
tony Tag: config dcom settings Tag: 217616
Format file writing
Hi,
I would like to write in test file "01","02", ....,"99"
For this I wrote,
Dim MyFile
Const ForWriting = 2
Set objFichier = CreateObject("Scripting.FileSystemObject")
Set MyFile = objFichier.OpenTextFile("test.txt",ForWriting,True)
for i = 1 to 99
m=""""+CStr(i)+""""+","
MyFile.Writeline m
next
MyFile.Close
Wscript.Quit 0
This doesn't work, as test.txt has,
1,
2,
3,
...
99,
1) How avoid to go to next line after each Myfile.Writeline ?
2) How to format 1 to 01 ? Tag: config dcom settings Tag: 217603
Are vbscript classes fast?
Hi there,
Just found these forums and my first post, so hi all
I'm doing some work with vbscript just now and had a quick question I hope
somebody could help with...
Say I have a few functions for accessing a database e.g. openDBConn,
closeDBConn, openRs, closeRs, getRsAsArray, executeSql, getDbConnString etc
I could put these functions in to an include file "incDbHelper.asp" and
include the file in any page that needs database functionality... or I could
create a class "clsDbhelper.asp" which again I would include in any page that
needs it. Now once the files have been included, to access the functions I
could do:
executeSQL("select * form table")
or
(if my db class is called Database)
set db = new Database
db.executeSQL("select * form table")
So my question is what is the best method? Using a class seems like extra
overhead for nothing? I've had a search around google but couldn't find
anything on performance issues when using classes. Does anybody have an
experience they could help me out with?
Thanks in advance for any help Tag: config dcom settings Tag: 217600
Searching Network Share Permissions
Hello,
I need to search for 'Everyone' and 'Authenticated Users' permissions on
every network shares from about 100 Windows Server 2003 servers we have and,
then, list only the network shares that have such permissions. Do you know
any effective tool or script to get this? I tried shareenum but it is not
useful to scan a specified group of servers.
Any input would be apreciated.
Thank you! Tag: config dcom settings Tag: 217587
Find pst files on c:\ and u:\
I copied the script from msdn
Option Explicit
Dim sFileName, sFilePath
sFileName = "*.pst"
sFilePath = "U:\"
Dim oFS 'file system object
Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
FindFile sFilePath, oFS
Sub FindFile(path, fso)
Dim oFC 'file collection object
Dim oFolder 'folder object
Dim eFile 'file element
Dim eFolder 'folder element
Set oFC = fso.GetFolder(path)
For Each eFile In oFC.Files'
If eFile.Name = sFileName Then
'echo file path
WScript.Echo eFile.Path
End If
Next
Set oFolder = oFC.SubFolders
'recursion starts here
For Each eFolder In oFolder
FindFile eFolder.Path, fso
Next
End Sub
I would like to first search in the c:\ than in the u:\. When I did the
search I got an error Access denied and The script stopped. I would like to
skip the file and keep going. Tag: config dcom settings Tag: 217585
How to delete specified files in a tree
Can I be helped?
How can I delete specific files from a computer directory and from the
subdirectories?
Thanks in advance for helping me.
Cisco Tag: config dcom settings Tag: 217582
Formatting Flash Drives via VBScript
Is it possible to format a Flash drive via VBScript. My ultimate goal is
to format several flash drives at the same time or syncronously through
script.
I do backups from several computers via USB Flash Drives on a 4 port hub..
After the backups are done, I would like to format these drives by VBScript
and not through windows formatting program as it takes too long to select
the drive and format for several drives.
Any help would be greatly appreciated. I have search google, hotbot, and
yahoo. But all examples and help are for fixed disks and my scripts error
out.
Thanx, Don Tag: config dcom settings Tag: 217577
Enumerating System Drivers
Can anyone tel me if there is a way to enumerate system drivers and
their state against a list of remote computers? This would be the same
information you see when running WINMSD on a server. I am looking for
the existence of a particular driver and whether it is loaded and
running. I believe I can utilize the driverquery command and then
parse that but I was hoping for some method using only vbscript and/or
WMI. Thank you. Tag: config dcom settings Tag: 217573
Renaming a CSV file based on content
Hi All,
many people helped me in my previous post, so thanks to them all - and
i now have a script that works for me...and save me a lot of time.(see
bleow)
however - i do have a new issue now - the script works fine until it
see a column with a slash in it (/) - and therefore wont rename the
file - is there an easy way to say that if it sees a / then name the
file to something?
help is much appreciated once again.
Jason
======================================================================
Const csDir = "Path"
Const csExt = "csv"
Set oFS = CreateObject( "Scripting.FileSystemObject" )
For Each oFile In oFS.GetFolder( csDir ).Files
If 0 = StrComp( csExt, oFS.GetExtensionName( oFile.Name ),
vbTextCompare ) Then
renCSVFile oFile, oFS
End If
Next
Sub renCSVFile( oFile, oFS )
On Error Resume Next
Const ForReading = 1
Dim sNewName : sNewName =
Split( oFile.OpenAsTextStream( ForReading ).ReadLine, "," )( 3 )
oFile.Name = sNewName & "-" & RndFileName & ".csv"
End Sub
Function RndFileName()
For x=1 To 8
Randomize
vChar = Int(36*Rnd)
If vChar < 10 Then 'append number
RndFileName = RndFileName & vChar
Else 'else append a letter
RndFileName = RndFileName & Chr(97+(vChar-10))
End If
Next
End Function
========================================================================= Tag: config dcom settings Tag: 217563
Problem with moving a file
Hello,
Using this script derived from a scriptcenter example, I'm trying to
move a file:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Temp" , "C:\Logs"
The above works but when I change the destination to a different
drive:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Temp" , "D:\Logs"
the script fails. I can move a folder from some source on C:\ to some
other location on C:\. But if the same operation tries to move from
C:\ -> D:\ then it fails with:
Line 2 Char 1
Permission denied
800A0046
What is really confusing to me is I'm running the script as a member
of domain administrators and that account has write access to D:\.
How can I get this script to move folders across drives?
Suggestions are greatly appreciated.
Thanks! Tag: config dcom settings Tag: 217558
Learn English!!!! Change ur language and you change ur thoughts.
Learn English!!!! Change ur language and you change ur thoughts.
Learn English and free download Grammar & dictionary.
Just click the website and share ur thoughts=85.
=93Give a man fish and he=92ll eat once!
Teach a man to fish and he=92ll eat for a lifetime=94.
http://Onlinespokenenglish.googlepages.com/home Tag: config dcom settings Tag: 217556
Query for string INSIDE Windows Event Log
Gentlemen,
New to the list so please be gentle. Need to achieve the following and have
been banging my head against the wall:
- In the process of deploying a full-disk encryption product that requires
checkdisk to run prior to installation. If any bad sectors are found, I need
to run check disk again and try to fix them. Unfortunately, check disk has no
logging mechanism other then Event Viewer: upon completion Event ID 1001 with
source of Winlogon is logged in Application log. Inside, it will have a
string that looks like this:
0 KB in bad sectors
This is the string I need to search for INSIDE the Event ID 1001 and if it's
not 0 KB, I need to stop installation and run another check disk on reboot. I
have figured out a way how to do all of the above with the exception of
searcing INSIDE events in Event Viewer.
If anyone has an idea or a pointer, I'd be forever greatful.
Thanks in advance! Tag: config dcom settings Tag: 217553
Is there a way to script dcom settings? I need to set a specific setting on
our workstations and trying to figure out the most efficient way to do so.