Email
I have a vbs script that runs at user logon however I'd like it only to run
if the user has an exchange mailbox, can you help?
--
Steve Tag: if email Tag: 216045
Adding a printer port
Question about a vbscript that would create an IP printer port and then
install a printer. The script would run against XP computers with
DeepFreeze installed. The plan would be to run the script during each
logon.
1. Will the process of creating each IP port take longer then 10 seconds or
so on each logon?
2. Is local administrator access required. Can I use Run As Administrator
account during the script? Tag: if email Tag: 216043
vbscript to traverse subfolders
Hey All....
Can anyone help me with the easiest way would be to make the script
below to traverse subfolders and perform the file copy from the txt
file list?
I want to remove the hard coded "source", and put the root folder H:\
and traverse it looking for the files.
Thanks in advance!!!!
set fso = createobject("scripting.filesystemobject")
Set objShell = CreateObject("wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objErrLog = objFSO.OpenTextFile("H:
\August07_Missing_Restore_Log.log", 8, True)
On Error Resume Next
sFile = "H:\August07.txt"
dest = "H:\Restore\August07\"
Set txtStream = fso.OpenTextFile(sfile) ' Open text file.
Do While Not (txtStream.atEndOfStream) ' Read each line of the file
Filename = txtStream.ReadLine
source = "\\server\archive\" & Filename
'wscript.echo source
If objFSO.FileExists(source) Then
intRunError = ObjShell.Run("%COMSPEC% /c Echo Y| fileacl " _
& source & " /o administrators", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strUser & " to file " & source
End If
Else
objErrLog.WriteLine source & " - Error: File Does Not Exist! - " &
Now
End If
fso.copyfile source, dest, true
Loop
wscript.echo "DONE!!!!" Tag: if email Tag: 216036
FSO
Hi everyone,
I'm having troubles with the FileSystemObject. I have two servers and I use
the FSO to make a backup from one to another. The connection between this
servers are too fast (1gbps) but, when I use the FSO with the CopyFile
method, this files are copied at no more than 10mbps. It's very slow. I
think that is a kind of problem that have the FSO and I ask you about if
there is another method to do it. I copy here a part of my vbs code
Thanks in advance,
Gregorio Aranda.
fichero_origen = subfolder.path & "\" & objFile.name
fichero_destino = replace(subfolder.path,carpeta_inicio,carpeta_destino) &
"\" & objFile.Name
Set fecha = objFSO.GetFile(fichero_origen)
fecha_fichero = fecha.DateCreated
if datediff("d",fecha_fichero,now())<14 then
if not objFSO.fileexists(fichero_destino) then
objFSO.CopyFile fichero_origen,fichero_destino,true
sw=0
end if
else
objFSO.DeleteFile (fichero_origen)
if objFSO.fileexists(fichero_destino) then
objFSO.DeleteFile (fichero_destino)
end if
end if Tag: if email Tag: 216023
check to see if machine certificate is for our domain
As part of wireless access, you can use EAP to authenticate workstations
that are in a domain and have a workstation certificate.
Thinking on those same lines, is there any way via script to check this said
machine/computer certificate on a PC?
Thanks!
Billy Tag: if email Tag: 216022
VBScript Error
Hello,
The following script is giving me this error:
Object required: {string: '["""D:\Program Files\Ju"]'
I've tried %20 and that did not work. What changes need to be made to
the VBScrit below to get rid of the above error.
Dim regedit, nFile
set regedit = CreateObject("WScript.Shell")
set nFile = """D:\Program Files\Just BASIC v1.01\My Programs
\eBookErrFix\eBookErrFix\eBookErrFix\CurrentFile.txt"""
nFile.write(regedit.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft
\Windows NT\CurrentVersion\Winlogon\DefaultUserName"))
Thank you for your help,
jfcby Tag: if email Tag: 216020
Script to delete sub folders
I'm looking for a script/tool that will delete all subfolders under a
specific folder that are 0k in size on a Windows 2003 File Server.
The following is the path where "#" would be the top level folder. Any 0k
sized folders under this folder would need to be removed.
D:\Datashare\Clients$\CLIENTFI\#
--
Santhosh Pallikara Tag: if email Tag: 216013
Printer Driver remote installation fail ???
Hello,
I try to install remotely a printer driver on a Server2003.
My code is:
if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
set oDriver = oService.Get("Win32_PrinterDriver")
oDriver.Name = "hp LaserJet 1320 PCL 6"
oDriver.SupportedPlatform = "Windows NT x86"
oDriver.Version = "3"
oDriver.FilePath = "C:\Drivers\HP\LaserJet
1320n"
oDriver.InfName = "C:\Drivers\HP\LaserJet 1320n
\hpc1320c.inf"
uResult = oDriver.AddPrinterDriver(oDriver)
end if
The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:\Drivers\HP....) are on the remote server.
I have try to declare paths also like that:
oDriver.FilePath = "C:\\Drivers\\HP\\LaserJet
1320n"
oDriver.InfName = "C:\\Drivers\\HP\\LaserJet
1320n\\hpc1320c.inf"
This code fail. What's wrong?
Thank you very much for your help.
Best regards
Jo Tag: if email Tag: 216007
wscript.shell Run file with space in path
I'm trying to run the following, but I always receive an error due to
the space between Program Files. I've tried quoting it in standard
style and in ascii but then the file cannot be found. The file is at
the path specified. Anyone see the error?
Set WSHShell = CreateObject("Wscript.Shell")
return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
\test.zip -y -oc:\ziptest *.txt -r",1,true) Tag: if email Tag: 215997
How to log users log-on-off time
Hi
Is it possible in Win2003 domain environment to get infromations when users
log-on and log-off into their computers?
My boss wants that when a user log-on and log-off into his computers, he
automatically gets an e-mail with the following data:
- user that has logged on/off
- the time of log-on/off
Can this be arranged via GPO or do we need custom VBS script? If so, does
anyone have it allready?
Thank you all in advance.
Regards,
Miha Tag: if email Tag: 215986
VBscript and HTML Forms
Hi all,
i'm just enjoiying with HTA and i'm trying to create a "dynamic" form
to enter data.
I mean, i create a form with 1 text field (name text[])
then with JS i dinamically add more text fields (named always text[])
With php i could access che post (or get) array text with all the
fields inside.
Can i do the same with VBscript in the HTA?
i can access the value of a single text field named text1 for example,
but i can't get dinamically the value of each field called text[]
why?
thanks! Tag: if email Tag: 215984
Error: Type mismatch
i have a vba code included the following:
shortest = count(1)
For r = 1 To 200
If count(r) < shortest And count(r) > 0 Then
shortest = count(r)
End If
Next
Rows("shortest:shortest").Select
Selection.Cut
Rows("1:1").Select
Selection.Insert Shift:=xlDown
However, when i try to run the code, the debugger promt an error
message said : type mismatch and then highlight the code:
Rows("shortest:shortest").select.
I declared "shortest" as variant.
Can any pro point out my mistake?Thank you very much Tag: if email Tag: 215979
Change Regional Settings
Hi Everyone,
I have a unique problem. Everytime my users log onto a workstation and
attempt to run a specific application it reports that they need to change the
system date format from m/d/yyyy to mm/dd/yyyy.
I currently have a script which updates the system everytime the user logs
onto the workstation. Is there a way I can invoke the system date change
during workstation bootup rather than when the user logs onto the workstation?
I appreciate anything you can do to assist with this issue,
Thank you,
D Tag: if email Tag: 215975
Editing users UPN via script
I have a text file called C:\Temp\USERS.TXT (which the format can be changed
if needed), that has the following (UserLogonName, UPN format):
User1, @mydomain.com
User2, @mydomain.com
User3, @mydomain.com
User4, @mydomain.com
User5, @mydomain.com
User6, @mydomain.com
I want to be able to change the UPN listing (in some cases it's not present
at all for users) that appears next to the "User logon name" on the Account
properties for those users in a script. I can edit a script to change this
for a user but in this case I want to be able to read in the information from
a file, can this be done editing this script? Or do I have to do it manually?
Set objUser = GetObject _
("LDAP://cn=User1,dc=NA,dc=mydomain,dc=com")
objUser.Put "userPrincipalName", "MyerKen@fabrikam.com"
objUser.Put "sAMAccountName", "MyerKen01"
objUser.Put "userWorkstations","wks1,wks2,wks3"
objUser.SetInfo Tag: if email Tag: 215965
Error 8007007E WScript.Network Wscript.CreateObject
I am getting an error in my .vbs script. The error is "Could not create
object named "WScript.Network". The code is 8007007E. The source is
WScript.CreateObject. The program errors on the "Set" line of code below.
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
However, if I add a drive mapping on my PC to a network share hosting a
company application, the script runs. As soon as I delete the mapping, the
script fails. Why is this happening? Why does mapping this drive allow the
script to run without errors?
--
Thanks! Tag: if email Tag: 215961
Email Signature Customization
Hi there. I am using the following script to create an email signature, but
I need to change font, use bold and italic and change font color for
different lines as well as pull in a JPG image.
Any help would be greatly appreciated.
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strPhone = objUser.telephoneNumber
strEmail = objUser.mail
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeText strEmail
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
Set objSelection = objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = True
objWord.Quit Tag: if email Tag: 215960
File copy with variable
I need to copy files to the user profile on the computer using my VBS login
script, and I need to make it conditional. Currently I have the following:
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists("c:\Folder\File.exe") Then
oFSO.GetFile("C:\Folder\File.exe").Attributes = 0 'In case it is read-only
oFSO.CopyFile \\server\share\file.exe, "c:\Folder\", True
End If
I need to do the following logic:
If exist C:\Documents and Settings\%username%\Application
Data\Microsoft\Signatures\%username%.htm
then copy \\server\share\%username%\*.* C:\Documents and
Settings\%username%\Application Data\Microsoft\Signatures\
If anyone can provide me with the code to do this, it would be greatly
appreciated. The conditional is not important, but the variable is.
THanks,
Michael Tag: if email Tag: 215955
How can I add this web site to my favorites?
This script starts IE and opens a web site.
Dim IE1
Set IE1 = WScript.CreateObject("InternetExplorer.Application")
IE1.Visible = True
IE1.Navigate
"http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx"
How can I add this web site to my favorites? Tag: if email Tag: 215938
active directory
I am looking online and and am finding quite a few different scripts to search
Actice Directory although not quite what I was after.
I need to search the active directory from the top down (across all OU) looking
for a user.
The part I am trying to grasp is, how do I use the result to then delete
this user wherever in the tree he / she may be.
I haven't found the type of script like this, but I am thinking this would
either return the location that I can assign into a variable or a true or
false state. But as I said I have not seen any examples and wondering if
anyone has some ideas or can direct me somewhere so I can take a look.
THank yo Tag: if email Tag: 215936
Display various columns in "Details Folder" settings
Hi
I'm searching for a vbscript which would help me in displaying the folder
details. eg. i want the folder view to be "Details" & with more columns like
"Title, Artist, Album title" etc.
can someone help.. thanks..
regards
Raghu Tag: if email Tag: 215934
logon.bat load map printer scripts
I will install around 30 printer in our network workstation. current our AD
login account load "login.bat" Now i have create map printer.vbs login
scripts. I want to know how to call vb script in logon.bat file.
Also when our network printer all of ricoh. I would like to know any vb
script for change the printer default page size to A4 size. Please advice.
ITTITIT
THX Tag: if email Tag: 215928
LastLogin not changing when users are accessing shared folders
I am working in a company that has a few different domains that have no trust
relationship.
Some of the users from a remote domain need to access a few shared folders
located on our domain.
Because there is no trust relationship between the two domains, these users
have
account in our domain.
Users can map the drives and access the resources and everything is fine
until I am running SOX reports and that is the time when
I see that "LastLogin" property is not updated for these users so I cannot
rely on
what is in stored in that variable to disable the accounts for inactivity
(e.g. 30 days
since last login).
Is there a way to fix this or a work around and have "LastLogin" updated
when they
authenticate in my domain?
I have a script for SOX but for tests I am using the following script:
On Error Resume Next
sDomain = Array("dc1","dc2","dc3")
UserID = InputBox("Please Enter User Name","User Name")
if UserID ="" then wscript.quit
For iCount = lbound(sDomain) To ubound(sDomain)
set UserS = GetObject("WinNT://" & sDomain(iCount) & "/" & UserID &
",user")
LastLoginOnS = LastLoginOnS & "Domain : " & sDomain(iCount) & "
" & UserS.LastLogin & vbcrlf
Next
Wscript.Echo UserS.AccountExpirationDate
Wscript.Echo "User Name : " & UserID & vbcrlf & vbcrlf & LastLoginOnS Tag: if email Tag: 215927
script to search text
I am trying to create a script that will read multiple text files inside a
specific folder and finds the device names that appears on more than one
file, then display in an excel sheet the device names and the number of times
it found the device name.
Details - I run a daily repot that shows the state of specific devices (
Device name is always the first six characters in a line and the state of the
device is always at the end of the line in between parethesis (state)). I
then export the report as a text file with the name of the day (mon.txt,
tue.txt etc. etc. ) to a folder in my computer. Report files show all Devices
with their repective state. Devices only show once in a report.
What I am trying to do is create a script that I will run on friday that
will check all the text files (monday - friday) then show the devices that
were shown in more than one file with a specific state. I will always look
for the same specific state i,e "(disabled)"
Any help with this script will be appreciated. Tag: if email Tag: 215904
Passing an argument
Hello,
I was wondering how I could call a vbscript and pass an argument when I
call it.
I want to pass a filename to be used
thanks Tag: if email Tag: 215903
Add ScriptPath to AD user - [WP]
trying to add logon.bat to under the AD users properties ....under Logon
Script field.
I ahve this Vb ...and I am not a VB guy ...can somebody please adddress for
me ...
I want the Logon.bat added Logon Script field to all my users in AD and the
ones which already have it shoudl be ignored.
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
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
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://cn=users,dc=lab,dc=local' WHERE
objectCategory='user' "
Set objRecordSet = objCommand.Execute
Const ADS_PROPERTY_APPEND = 3
objUser.PutEx ADS_PROPERTY_APPEND, _
objUser.scriptPath, ("logon.bat")
objUser.SetInfo
Advise Please. Thanks Tag: if email Tag: 215893
popup email window
could i get a script to popup the default email client and populate the To:
address with a default addy?
tia,
mcnewsxp Tag: if email Tag: 215890
Scripting Mapped drives
Hi all
I currently run a w2k3 domain and have a logon script mapping drives through
group membership. occasionally laptop users and some desktop users loose
there mapped drives at which point they call and we tell them to relogon.
laptop users sometimes come back into the office after using there laptop at
home and instead of shutting down put it into standby or hibernate then wjen
they boot in the office they dont logon and dont map drives.
Anyone else have or have a similar problem, any solutions?
I was thinking of putting a timer into the script to remap drives every so
often or installing some scripts locally not sure.
thanks Tag: if email Tag: 215889
Encrypt the SQL connection string in ASP Page using VB Script
Hi All,
My SQL server got hacked 2 times. Using SSL is not an option in my
company noe. I got 2 days to encrypt the SQL connection.How do I encrypt the
connection string.
Connection string is as follows.
strcon="Driver=SQL
Server;Server=test;UID=uid;PWD=pwd;Database=test;DSN=\\test\C$\test.dsn"
I wam will to change any thing in the SQL server too. But I don't have
access to Webserver.I know some application is reading the password from the
ASP page
and logging into the system.
Please help.It is very urgent and I am kind of panic now.
SMV Tag: if email Tag: 215882
HTA scroll to top when window is resized
In an HTA using VBScript, there is a control that allows the user to collapse
the HTA window to a smaller size. When this happens I want the window to
scroll to the very top.
Could someone please toss me the command to do this?
Thanks in advance. Tag: if email Tag: 215880
I'm missing something obvious...
Hey guys,
For some reason, when I run the following script, I'm getting a "Object
doesn't support this property or method" error on line 20. (LogFile =) and i
just can't seem to figure out what I'm getting wrong. Think you guys can
take a look?
Thanks!
Code:
Option Explicit
'On Error Resume Next
Dim objShell
Dim FSO
Dim RegUserName
Dim RegCompName
Dim User
Dim Comp
Dim LogFile
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
RegUserName =
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser"
RegCompName =
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
User = objShell.RegRead(RegUserName)
Comp = objShell.RegRead(RegCompName)
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
LogFile = FSO.OpenTextFile("M:\Test.txt", ForAppending, True)
LogFile.Write " "
LogFile.Write "ComputerName" & " " & Comp
LogFile.Write "is being used by" & " " & User
LogFile.Write Date
LogFile.Write " "
LogFile.Close Tag: if email Tag: 215878
Problem passing cn's with spaces
Hi
I'm stuck. I've got a script (listed below) that asks for a user's name and
then disables the corresponding AD account, adds the associated external
account permission to the SELF account and then moves it to a specified OU.
My problem is that if the user's name has a space in it (ie John Doe) then
the associated external account permission will not be assigned to the SELF
account. If the user name has no space in it then everything works perfectly.
Any ideas?
********************************************************
On Error Resume Next
'Defines from which container search will start
Const ADS_SCOPE_SUBTREE = 2
Const ADS_USERDISABLED = &H00002
const E2K_MB_FULL_MB_ACCESS = &H00001
const E2K_MB_SEND_AS = &H00002
const E2K_MB_EXTERNAL_ACCOUNT = &H00004
const E2K_MB_READ_PERMISSIONS = &H20000
const E2K_MB_TAKE_OWNERSHIP = &H80000
const ADS_ACE_REVISION_DS = &H00004
const ADS_ACETYPE_ACCESS_ALLOWED = &H00000
const ADS_ACEFLAG_INHERIT_ACE = &H00002
'Sets User Flag Parameter
Const ADS_UF_ACCOUNTDISABLE = &H2
Dim strUserName
'Creates an input box to type in user's name
strUserName = InputBox("Enter the username:")
'connect to AD
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://DC=london,DC=glenrand'" & _
"WHERE objectCategory='User'" & _
"AND cn='" & strUserName & "'"
Set objRecordSet = objCommand.Execute
'Get user record
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strPath = objRecordSet.Fields("ADsPath").Value
Set objUser = GetObject(strPath)
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Call SetmsExchMasterAccountSid
'Move user to Ex Employees OU
Set objNewOU = GetObject("LDAP://OU=exemployees,DC=london,DC=glenrand")
intReturn = objNewOU.MoveHere(strPath, vbNullString)
objRecordSet.MoveNext
Loop
msgbox "The user account for " & strUserName & " has been disabled"
'This function sets the msExchMasterAccountSid value in ADSI to SELF.
'ie Adds Associated External Account permission to the SELF account.
Function SetmsExchMasterAccountSid
Dim objSD
Dim objACL
Dim objACE
Dim found
objUser.Put "msExchMasterAccountSid", objUser.Get("objectSID")
'Get the mailbox security descriptor
set objSD = objUser.Get("msExchMailboxSecurityDescriptor")
set objACL = objSD.DiscretionaryAcl
found = false
for each objACE in objACL 'Iterate through the ACL
to find the SELF-Account
if objACE.Trustee = "SELF" Then
found = true
Exit For
end if
next
if not found then 'If no SELF-Account is present, create it
set objACE = CreateObject("AccessControlEntry")
objace.Trustee = "SELF"
objace.AceFlags = ADS_ACEFLAG_INHERIT_ACE
objace.AceType = ADS_ACETYPE_ACCESS_ALLOWED
objacl.addace objace
end if
'Give the SELF-Account the External-Account right
objace.AccessMask = objace.accessmask OR E2K_MB_READ_PERMISSIONS OR
E2K_MB_FULL_MB_ACCESS OR E2K_MB_EXTERNAL_ACCOUNT
'Save the changes
objUser.Put "msExchMailboxSecurityDescriptor", objSD
objUser.setInfo
Set objSD = Nothing
Set objACL = Nothing
Set objACE = Nothing
End Function Tag: if email Tag: 215871
check and add a registry key
Hi,
is it possible to have a script that checks a remote PC (running XP pro) to
see whether a particular registry key exists, if not run a xyz.reg file to
add it on the remote PC?
thanks in advance, Tag: if email Tag: 215870
Active Directory GetObject function fails
Does anyone know why this would happen?
We find some users can run this code and some cannot - but we dont know why:
Code:
Set objSysInfo = CreateObject("ADSystemInfo")
objADUser = objSysInfo.UserName
Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some users
strUserF = objUser.FirstName
strUserL = objUser.LastName
strEmail = objUser.EmailAddress Tag: if email Tag: 215866
Need help with WMI SQL syntax.
I am trying to search multiple machine's Event log for several events.
I'm trying to do it in one pass, and I think I'm close.
This query does not return any data when run against a machine with known
events.
Can anyone give me a hand?
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where " _
& "(Logfile = 'System' and EventCode =
'1054')"_
& "Or (Logfile = 'System' and EventCode = '1000')" _
& "Or (Logfile = 'System' and EventCode = '1030')" _
& "Or (Logfile = 'System' and EventCode = '1085')" _
& "Or (Logfile = 'System' and EventCode = '5')") Tag: if email Tag: 215856
AD : External Account Association
hi, i have to write a script to associate an external account to a
disabled ad user.
I have the following code.it gives me an error(-2147016657) in the
last line and i can't update "ntSecurityDescriptor" maybe because i
wrote in a bad way the addace call.
can anyone help me?
Set oSID = CreateObject("ADsSID")
oSID.SetAs 2, NTUser
RawSID = oSID.GetAs(0)
oUser.Put "msExchMasterAccountSID", RawSID
oUser.SetInfo
Set oSecurityDescriptor = oUser.MailboxRights
Set dacl = oSecurityDescriptor.DiscretionaryAcl
objSD = oUser.Get("ntSecurityDescriptor")
Set objDACL = objSD.DiscretionaryACL
AddAce dacl, NTUser, 131079, ADS_ACETYPE_ACCESS_ALLOWED,
ADS_ACEFLAG_INHERIT_ACE, 0, 0, 0
oSecurityDescriptor.DiscretionaryAcl = dacl
oUser.MailboxRights = oSecurityDescriptor
oUser.SetInfo
AddAce objDACL, NTUser, ADS_RIGHT_DS_CONTROL_ACCESS,
ADS_ACETYPE_ACCESS_ALLOWED_OBJECT, 0, 0,
"{ab721a54-1e2f-11d0-9819-00aa0040529b}", 0
objSD.DiscretionaryAcl = objDACL
oUser.Put "ntSecurityDescriptor", Array(objSD)
oUser.SetInfo Tag: if email Tag: 215855
Script to determine Service Pack on numerous servers
Hello,
I'm not a scripting guy so I need some assistance. I need to obtain the
service pack levels on numerous servers. Is there a script I can use that
could read a list of servers in a text file and output the answers to either
a text file or CSV? Tag: if email Tag: 215854
mapi - accepting Appointment automatic
when i accept an appointment automaticly i see in the meeting in the calender
at the bottom part :
[QUOTE]
When: ??? ????? 06 ??? 2008 14:00-14:30 (GMT+02:00) Jerusalem.
*~*~*~*~*~*~*~*~*~*
[/QUOTE]
when i check the vb6 code i see that :
objMessage.Text - contians the ==>>"*~*~*~*~*~*~*~*~*~*"
the thing is that when i accept an appointment manually the
"*~*~*~*~*~*~*~*~*~*" dosent appear in the meeting in the calendar, but when
i do that using code it dose!
can i change this?? can i get read of the "*~*~*~*~*~*~*~*~*~*"???
this is the code is user
[CODE]
Dim oSession, strServer, strMailbox, strProfileInfo, oInbox
Set oSession = CreateObject("MAPI.Session")
strServer = "servsername"
strMailbox = "mailboxname"
strProfileInfo = strServer + vbLf + strMailbox
oSession.Logon "", "", False, True, 0, True, strProfileInfo
Set objFolder = oSession.Inbox
Set objMessages = objFolder.Messages
Const CdoResponseAccepted = 3
Const CdoMeetingItem = 27 'MeetingItem object
Const CdoMeetingRequest = 1
For Each objMessage In objMessages
If objMessage.Class = CdoMeetingItem Then
If objMessage.MeetingType = CdoMeetingRequest Then
Set objAppointment = objMessage.GetAssociatedAppointment()
If objAppointment.MeetingStatus = CdoMeetingCanceled Then
MsgBox "in1"
MsgBox "ConfirmInvetation - metting request got
cancel ", "", eInfo
objAppointment.Delete
Else
MsgBox "in2"
Set objAppt = objMessage.Respond(CdoResponseAccepted)
MsgBox objAppt.Text
objAppt.Text = "daniela help"
MsgBox objAppt.Text
MsgBox objMessage.Text
MsgBox objMessage.subject
MsgBox "ConfirmInvetation - got metting "
objAppt.Send
MsgBox "ConfirmInvetation - Reply sent"
End If
End If
objMessage.Delete
MsgBox "ConfirmInvetation - Message deleted"
Set objAppointment = Nothing
Set objAppt = Nothing
End If
Next
[/CODE]
thnaks in advance
peleg Tag: if email Tag: 215845
set password expiration date
Hi ,
I was looking for a way to set a password expiration to a specific date
using the user's "pwdlastset" attribute.
The problem is that it seems impossible to set the attribute to a value
other than 0 ( which set the user to change the password at next logon ) .
Does anyone know how to solve it ?
thanks
Stefano Tag: if email Tag: 215844
Emulate PSEXEC/RunAS with the CreateScript method?
I'd like to execute a VB script on a remote system with credentials
different from the one launching the script- currently, I've been
using SysInternal's PSEXEC to do this, but, I would rather not call an
external exe, I'd like to keep everythng within VBS. The CreateScript
method looks like what I want, but I can't figure out how impersonate
an account with this.
Can anyone tell me how or point me in the right direction on how to do
this?
Thanks! Tag: if email Tag: 215842
get file creation date down to seconds
Is it possible to get the file creation date down to the seconds? I was
using the Folder.GetDetailsOf(FileName, 3) method to get the file's date,
but it's only good down to the minute, I need it down to the seconds.
Any help would be appreciated.
Thanks.
--
Mike Tag: if email Tag: 215841
script to copy file
I am trying to write a script that I thought would be simple to copy a single
filr to many pc's. The script fails with a path not found error. If I write
the line out it is a valid path. It is failing on where to copy the file.
The code opens a text file and reads the names of pc's that are that.
Currently just in testing and failing with 2 systems in the file.
Any help is greatly appreciated
Here is my code:
On Error Resume Next
'get main objects/variables
Dim strPath, strFileToRead, strLogFile
strPath = "C:\CopyWinPrint\"
strFileToRead = "computers.txt"
strLogFile = "log.txt"
Dim strComputers
Dim fsoRead, tsRead
Const ForReading = 1
Set fsoRead = CreateObject("Scripting.FileSystemObject")
Set tsRead = fsoRead.OpenTextFile(strPath & strFileToRead, ForReading)
strComputers = tsRead.ReadAll
tsRead.Close
Set fsoRead = Nothing
strComputers = Split(strComputers, vbCrLf)
Set oFso = CreateObject("Scripting.FileSystemObject")
For x = 0 to UBound(strComputers)
strOut = ""
strComputersText = Trim(CStr(strComputers(x)))
'strComputersText = "RIC0000016"
Set oFso_fileName =
oFso.GetFile("\\riclog01\deploy\Assist_Rollout\Winprint\winprint.exe")
oFso_fileName.Copy "\\" & strComputersText &
"\c$\WINDOWS\system32\winprint.exe" , True
'MsgBox("\\" & strComputersText & "\c$\WINDOWS\system32\winprint.exe")
If Err.Number <> 0 Then
strOut = strOut & vbCrLf & strComputersText & vbTab & err.description & "!"
Err.Clear
Else
strOut = strOut & vbCrLf & strComputersText & vbTab & "No error!"
End If
Next
Dim fsoWrite, tsWrite
Const ForWriting = 2
Set fsoWrite = CreateObject("Scripting.FileSystemObject")
Set tsWrite = fsoWrite.CreateTextFile(strPath & strLogFile, True)
tsWrite.WriteLine(strOut)
tsWrite.Close
Set fsoWrite = Nothing Tag: if email Tag: 215840
free editor and debugger
Any free tools or great debuggers for beginners to download ?
Notepad is not very friendly.
Looking for tips and advice.
Thanks Tag: if email Tag: 215839
Write a log
Hello,
How can i write a log with the execution of a vbs script?
When i execute a batch like this:
msiexec /x {35C03C04-3F1F-42C2-A989-A757EE691F65} REMOVE=ALL REBOOT=R /L*
c:\temp\mcafee.log /quiet
I can see the result in the log file but when i execute a vbs, is posible do
this?
Thanks and sorry....i'm a bad scriptter.... Tag: if email Tag: 215836
Count of TXT files in a folder
In an HTA, using VBScript, I need to get a count of only files having a TXT
file extension in a specific folder.
Can someone please post generic example code to do this?
Thanks much in advance. Tag: if email Tag: 215825
Initiate a cluster failover
I'm trying to write a script to initiate a failure on a cluster group to
another node, I want the behavior to mimic the behavior when you right-click
a resource in cluster administrator, and select "initiate failure".
This snippet below is using the FailResource method, but doesn't seem to
initiate a failure for the cluster group, it seems to be just for testing, it
looks to just fail the individual resource for a moment and that's it.
Set colResourceList = objWMIService.ExecQuery _
("Select * from MSCluster_Resource WHERE Name = 'TestResource'")
For Each objResource in colResourceList
objResource.FailResource
Next
Any ideas to initiate a true failure like you can in the GUI of Cluster
Administrator?
I was able to use the MoveToNewNode method of the MSCluster_ResourceGroup
Class, but then if I code in the name of that node, and it's already on that
node, that doesn't meet the requirements. Tag: if email Tag: 215824
Delete network printers
I am using the script to delete all network printers installed on a
workstation.
Is there a way to specify to delete on the printers on a specific printer
server?
For example:
\\prntsrvr1\printer1
\\prntsrvr2\printer2
Is there a way to say delete all printers pointing to prntsrvr2? Tag: if email Tag: 215823
Delete all files in folder
I'm developing an HTA in which I need to delete all files in a folder. I was
surprised to find that the following doesn't work?
Kill MyPathName & "*.*"
Does this mean I have to loop thru all the files in the folder using FSO?
Is there a more efficient/expedient method?
Thanks much in advance for your assistance. Tag: if email Tag: 215821
List all domain accounts on remote machine
I'm using HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList to list all the users on a remote machine and
then use that information to get other information from Active Directory. How
can I find out which accounts are local accounts and which are domain
accounts? I don't want to waste time hitting the AD for the local accounts.
Any advice to determine which are domain accounts? Tag: if email Tag: 215815
The user logon on script includes an email signature vbs script however I
would only like that to run if they have an exchange mailbox, can you help?
--
Steve
If it exists, then the user has an exchange server.
-Corey
"Steven" wrote:
> The user logon on script includes an email signature vbs script however I
> would only like that to run if they have an exchange mailbox, can you help?
> --
> Steve
>