Install a printer in black and white
Hi.
How can I install a printer in black and white by default by means of a
script?
Regards Tag: Defrag Hard Disks Tag: 211392
Selecting current week in drop down
Hi All,
In a drop down box i am populating all the weeks from 1 to 52, but
whenever the page loads, i want it show the current week number as
selected value.
Below is what is did:
<option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
option>
But when my page loads, the drop down box shows the last week in the
list (52), instead of current week which is 43.
please let me know i am missing something.
appreciate any ideas on this.
Thank you!!
Navin Tag: Defrag Hard Disks Tag: 211391
Do not support HTML in textarea - on server-side
Hi,
I have a textarea and I would like to prevent users from inserting
HTML tags. Only plain text is supported.
Which server-side vbscript regular expression is best for this?
Thanks, Gabi Tag: Defrag Hard Disks Tag: 211390
Help Splitting a String
Can anyone help me please.
I am trying to split a users homedrive which I input using the
following code, the problem is I get an error when trying to split the
name. I basically want to get the servername and the home drive share
name as two seperate values so I can then use them seperatly.
The Home drive is displayed as "\\Servername\Sharename$"
username = "HJSimpson"
Const ADS_PROPERTY_DELETE = 4
Const ADS_PROPERTY_APPEND = 3
'Open connection to AD using LDAP
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://dc=name,dc=name>"
strFilter = "(&(objectCategory=person)(sAMAccountName=" & username &
"))"
strAttributes = "sAMAccountName,AdsPath,distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes
objCommand.CommandText = strQuery
Set ADSIRecordSet = objCommand.Execute
strName = ADSIRecordSet.Fields("sAMAccountName").Value
errorNum = err.number
errorDesc = err.description
strAdsPath = ADSIRecordSet.Fields("AdsPath").Value
strDN = ADSIRecordSet.Fields("distinguishedName").Value
Set objUser = GetObject("LDAP://" & strDN)
strDisplayName = objUser.displayname
strDescription = objUser.description
err.number = "0"
Set usr = GetObject(strAdsPath)
homedir = usr.homedirectory
MsgBox homedir - This bit is OK
a=Split(homedir,"\",-1,1) - This bit is not OK.
If InStr(a, "\\") Then
newservername = len(a,3)
Else
'Do Nothing
End If
MsgBox newservername
WScript.Quit:
Please help. Thanks Tag: Defrag Hard Disks Tag: 211389
Error 800A0046 with Shell.Run, but .Exec works
Hello,
I use VBScript to execute an application on a network drive.
The script looks like this:
<-----------------
const cFolder = "S:\Apps\MyProg"
const cPrg = "prg.exe"
set oShell = CreateObject("WScript.Shell")
with oShell
.CurrentDirectory = cFolder
call .Run(cFolder & "\" & cPrg)
end with
<-----------------
With some users, this script fails executing "call .Run()" with error
800A0046 - Permission denied.
If I replace "call .Run()" with "call .Exec()" using exact the same parameter,
the same user can run the script without any problems.
What is the difference between .Exec and .Run?
Why does .Run fail sometimes?
Thank you very much,
Josef Tag: Defrag Hard Disks Tag: 211385
Edit a txt file
Dear All,
Pls help, I have a text file which I need to edit. The script should
search for a particular text using readline and then append a certain
text to that line.
The text file looks like
blah blah
blah blha
blah
happyb'day=gaurav
blah blah
It should look like this after modification
blah blah
blah blha
blah
happyb'day=gaurav,thanks
blah blah
P.S - The line # where "Happy'bday=gaurav" is not fixed.
Pls help, I need to get going on this and even a little insight will
be very helpful.
Thanks in advance
Gaurav Tag: Defrag Hard Disks Tag: 211380
MS Office 2003 Author change
Is there a way to change the author of documents created by word, excel, etc,
so that it reflects the user that is logged in and not the organization? I
would like to create a script so this is done automatically but it seems that
UserInfo in the registry is encrypted. Is there a way around this or an
additional key that can be entered? This is to prevent students from copying
other student's work in an Office class. Tag: Defrag Hard Disks Tag: 211379
Win2k3 > SP2 - Anything that can/will affect LDAP queries?
Hi,
Is there anything in SP2 for Windows Server 2003 that could affect
LDAP queries that we currently have in place that anyone knows of?
Thanks in advance. Tag: Defrag Hard Disks Tag: 211377
Reading the + in Querystring
Hi All,
I have a querystring that contains the + sign as a separator, I need to read
these values individually in a select statement, for example.
&text=Single+205
where single is the type of room somebody wants and 205 is the user ID in
the Customer table.
Please help.
Regards
Simon Tag: Defrag Hard Disks Tag: 211373
netobj.GetSystemInfo() in ASP/VBScript
I am looking to find the IP address, MAC address, Windows Version etc. and
ideally I want to know if some specific components are installed such as our
plugin to WM Player. Is this possible in ASP? I know it is in
.Net and in Javascript there is this function netobj.GetSystemInfo()
How would I do this in plain ASP and/or ASP with vbscript?
Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com Tag: Defrag Hard Disks Tag: 211372
Change value of "Logon script" for all users to nothing
Hi,
I'm relatively new to VBScript. I have successfully written a couple
of logon scripts for my company, with half-decent validation & program
flow. I now need to deploy this, and remove the old batch logon script
from users' account objects in AD.
Having read some posts, I've seen suggestions ranging from:
selecting multiple users in AD & selecting "Properties", then making
the change (this doesn't work on either WinXP SP2 or Win 2000)
to
using LDIFDE to export the desired information, make the change, then
re-import this data to update the schema. However, LDIFDE looks
extremely complex & bug-prone - see http://support.microsoft.com/kb/555634.
For example, this document suggests that blank values can't be used to
set attributes, which ruins my plans. It also contains lots of caveats
- by default, accounts are disabled, passwords set to NULL, "user must
change password at next logon", etc, making for a very complex series
of switches & arguements for performing any import.
Is there no way of simply using VBScript to build a collection of user
objects and loop through them, setting the desired value? Any
suggestions would be greatly appreciated.
Many thanks,
Stevie
"Normal is as normal does..." Tag: Defrag Hard Disks Tag: 211371
passing a WMI collection value as a property
Hi, Please Help !
I am trying to write a script that loads some counter details from a SQL
table, executes a WMI query and then writes the results back to a SQL table.
The script will loop through the counters that it loads. My problem is I run
my WMI query
set colsettings = objWMIService.ExecQuery("SELECT PercentProcessorTime FROM
Win32_PerFormattedData_PerfOS_Processor where name = '_Total'). The actual
query contains references to the recordsets returned from SQL server
containing the counter details. For example "PercentProcessorTime" above is
replaced with objCounterRecordSet.Fields.Item("WMIProperty") and also the WMI
Class is replaced with a reference to the recordeset.
I now have one element in the reurned collection which I have to loop
through. For testing I am only trying to retrieve the value.
For each objItem in colsettings
wscript.echo objitem.PercentProcessorTime
Next.
The problem is I have several counters in my SQL table and am looping
through them so I need to replace "PercentProcessorTime" above with which
ever WMIClass parameter I happen to be working with and I cannot get this to
work. I guess what I am trying to do is use the value in a recordset as a
property for an object.
Anybody got any ideas or am i trying to do something that cannot be achieved. Tag: Defrag Hard Disks Tag: 211369
Problems creating an exchange mailbox and setting permissions
Hi All,
I hope someone can help.
I am having problems accessing the Security Descriptor when creating a
New User. It errors telling me an object is required with error 424.
I have this working on other infrastructures the same as it is in this
code and therefore can not understand why it is not working.
The bit of the code which is failing is the Function to Create The
Exchange Mailbox the rest is working fine.
Here is the code
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>New User Creation Utility</TITLE>
<HTA:APPLICATION ID="oCreateAccount"
APPLICATIONNAME="AccountCreationScript"
BORDER="thin"
CAPTION="yes"
ICON="SETUP.ICO"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SCROLL="NO"
SYSMENU="yes"
WINDOWSTATE="normal"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="yes">
</HEAD>
<style>
BODY
{
background-color: "#E4EAF6";
font-family: Helvetica;
font-size: 14pt;
color: "#000080";
margin-top: 5%;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 5%;
}
</STYLE>
<SCRIPT LANGUAGE="VBScript">
<!--
'=================================================================================================================================================
'***When the Script window loads set the size and location of the
window.***
'=================================================================================================================================================
sub Window_Onload
self.focus()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From
Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 800) / 2
intTop = (intVertical - 600) / 2
window.resizeTo 800,600
'window.moveTo intLeft, intTop
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
end sub
'=================================================================================================================================================
'***Clear any stored Values from the entry fields.***
'=================================================================================================================================================
sub btnReset_Click
txtFirstname.value = ""
txtMiddlename.value = ""
txtLastname.value = ""
txtRefnumber.value = ""
txtRequestor.value = ""
ListAccType.value = "AccTypeStart"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
end sub
'=================================================================================================================================================
'***Collect information for new user entered by the Administrator.***
'=================================================================================================================================================
sub btnRunScript_click
firstname=txtFirstname.value
middlename=txtMiddlename.value
lastname=txtLastname.value
referencenumber=txtRefnumber.value
Requestor=txtRequestor.value
AccountType=ListAccType.value
'Formatting the text to make sure that the details are correct
firstname=UCASE(left(firstname,1))+LCASE(mid(firstname,2))
middlename=UCASE(left(middlename,1))+LCASE(mid(middlename,2))
If mid(lastname,2) = "'" Then
lastname=UCASE(left(lastname,3))+LCASE(mid(lastname,4))
Else
lastname=UCASE(left(lastname,1))+LCASE(mid(lastname,2))
End If
btnRunScript.disabled = true
btnReset.disabled = true
btnClose.disabled = true
if firstname="" then
msgbox "Please enter the users First Name"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
elseif lastname = "" then
msgbox "Please enter the users Surname"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
elseif referencenumber = "" then
msgbox "Please enter the Reference Number"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
elseif Requestor = "" then
msgbox "Please enter the Requestor's Name"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
elseif AccountType = "AccTypeStart" then
msgbox "Please select the Account Type"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
else
'do nothing
end if
call
createAccount(firstname,middlename,lastname,referencenumber,Requestor,AccountType)
end sub
'=================================================================================================================================================
'***Collect information for new user entered by the Administrator,
then create the account.***
'=================================================================================================================================================
sub
createAccount(firstname,middlename,lastname,referencenumber,Requestor,AccountType)
'On error resume next
intAccValue = 544
inputdomain="Domain"
inputou="OU"
Set wshshell = CreateObject("wscript.shell")
username = wshshell.expandenvironmentstrings("%username%")
strDomain="Domain.Com"
CurrDateTime=now
firstinitial = UCASE(left(firstname,1))
strFile = "filepath"
strExServer = "Servername"
strProfPath = "\\Servername\User$\P"
strHomeDir = "\\Servername\User$\H"
strTempPath = strHomeDir & firstinitial & "\_Template\"
msgbox "Please verify the following details of the account to create"
& VBCRLF & "Firstname: " & firstname & VBCR & "Middlename: " &
middlename & VBCR & "Lastname: " & lastname & VBCR & "Reference
Number: " & referencenumber
MsgboxResult=msgbox("Is this information correct?",
259,"Confirmation")
if MsgboxResult = 7 then
txtFirstname.value = ""
txtMiddlename.value = ""
txtLastname.value = ""
txtRefnumber.value = ""
ListAccType.value = "AccTypeStart"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
elseif MsgboxResult = 2 then
window_close
exit sub
else
'do nothing
end if
'Connect to the usersdatabase to get sitedetails and record the
transaction
set conn=createobject("adodb.connection")
conn.connectiontimeout = 30000
conn.commandtimeout=30000
set myset=createobject("adodb.recordset")
conn.open "Driver={Microsoft Access Driver
(*.mdb)};Dbq=UserAdmin.mdb;"
sql="select * from Exchange where exchangeserver='" & strExServer &
"'"
'Msgbox sql
set myset=conn.execute(sql)
exchangeserver=myset("exchangeServer")
storagegroup1=myset("storagegroup1")
storagegroup2=myset("storagegroup2")
informationstore1=myset("informationstore1")
informationstore2=myset("informationstore2")
informationstore3=myset("informationstore3")
informationstore4=myset("informationstore4")
informationstore5=myset("informationstore5")
informationstore6=myset("informationstore6")
informationstore7=myset("informationstore7")
informationstore8=myset("informationstore8")
informationstore9=myset("informationstore9")
'Create a temporary account name
testusername=UCASE(left(firstname,1) & left(middlename,1) &
left(lastname,1)) & LCASE(mid(lastname,2))
'Check if there is an account with this name already
nameok=testaccount(testusername)
if nameok=0 then
' The account name is already in use, need to alter the name used
msgbox "This Account name is already in use, there is a duplicate
entry." & VBCRLF & "Please verify the details entered, you will need
to start again once the details have been verified."
txtFirstname.value = ""
txtMiddlename.value = ""
txtLastname.value = ""
txtRefnumber.value = ""
txtRequestor.value = ""
ListAccType.value = "AccTypeStart"
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
exit sub
else
' This name is free so use it
end if
'Now we create the base user account so that we can assign properties
to it
objectname="LDAP://ou=users,ou=" & inputou & ",dc=" & inputdomain &
",dc=COM"
'Now we create the new user account so that we can set its properties
Set ou = GetObject(objectname)
'Have to remember to escape the , by preceeding it with a \, so
smith, john becomes smith\, john this still shows as smith, john in
the gui though.
If middlename = "" Then
fullname="cn=" & firstname & " " & lastname
Else
fullname="cn=" & firstname & " " & middlename & " " & lastname
End If
Set usr = ou.Create("user", fullname)
usr.Put "samAccountName", testusername
usr.SetInfo
usr.lastname = lastname
usr.givenname = firstname
if len(middlename)>0 then
usr.initials=left(middlename,1)
end if
usr.setinfo
usr.userPrincipalName=testusername & "@" & inputdomain & ".co.uk"
If middlename = "" Then
usr.displayname=firstname & " " & lastname
Else
usr.displayname=firstname & " " & middlename & " " & lastname
End If
usr.description=AccountType
usr.setinfo
usr.profilepath=strProfPath & firstinitial & "\" & testusername
usr.homedrive="P:"
usr.homedirectory=strHomeDir & firstinitial & "\" & testusername
usr.SetInfo
usr.info="Created via script by " & username & " on " & now & " Ref:
" & referencenumber & VBTAB & "Requested by: " & Requestor
usr.SetInfo
usr.Put "userAccountControl", intAccValue
usr.setinfo
homedir = usr.homedirectory
profiledir = usr.profilepath
'Now we need to create the homedrive and profilepath for the account
set fso=createobject("scripting.filesystemobject")
if fso.folderexists(usr.homedirectory) then
msgbox "There is already a home directory for this user. Please
verify it is correct and with the correct permissions"
else
set f=fso.createfolder(usr.homedirectory)
end if
if fso.folderexists(usr.profilepath) then
msgbox "There is already a profile directory for this user. Please
verify it is correct and with the correct permissions"
else
set f=fso.createfolder(usr.profilepath)
end if
'And set the permissions
cmdline="cmd /c setacl.exe -on " & homedir & " -ot file -actn ace -
ace " & "n:" & inputdomain & "\" & testusername &
";p:full;s:n;i:sc,so;m:grant;w:dacl"
cmdline1="cmd /c setacl.exe -on " & profiledir & " -ot file -actn
ace -ace " & "n:" & inputdomain & "\" & testusername &
";p:full;s:n;i:sc,so;m:grant;w:dacl"
Set WshShell = CreateObject("WScript.Shell")
poi=wshshell.run(cmdline)
poi1=wshshell.run(cmdline1)
'Copy the _Template folder and it's contents to the Users Home Folder
fso.CopyFolder strTempPath & "*.*", homedir, True
'Now we enable the account
res=addgroups(inputdomain,testusername,AccountType)
strDate = now
'get numeric value for day of the week
myDayName = WeekDay(strDate)
'convert numeric value to day name
myDayName = WeekDayName(myDayName)
DayofWeek = LCASE(myDayName)
CurrentDay = Dayofweek
usr.Accountdisabled=0
strPassword=CurrentDay
usr.setpassword strPassword
usr.put "pwdLastSet", 0
usr.setinfo
'Now we create the mailbox
'***First convert the first character of the firstname into an ascii
code***
'***In order to sort the user into the correct Information
Store ***
FirstChar= "H"
FirstCharAsci=Asc(FirstChar)
AsciA=Asc("A")
AsciB=Asc("B")
AsciC=Asc("C")
AsciD=Asc("D")
AsciE=Asc("E")
AsciF=Asc("F")
AsciG=Asc("G")
AsciH=Asc("H")
AsciI=Asc("I")
AsciJ=Asc("J")
AsciK=Asc("K")
AsciL=Asc("L")
AsciM=Asc("M")
AsciN=Asc("N")
AsciO=Asc("o")
AsciP=Asc("P")
AsciQ=Asc("Q")
AsciR=Asc("R")
AsciS=Asc("S")
AsciT=Asc("T")
AsciU=Asc("U")
AsciV=Asc("V")
AsciW=Asc("W")
AsciX=Asc("X")
AsciY=Asc("Y")
AsciZ=Asc("Z")
Call RUS
strAlias=UCASE(Left(firstname,1) & left(middlename,1) & left(lastname,
1)) & LCASE(Left(lastname,2))
smtpok = testsmtp(firstname,middlename,lastname,inputdomain,strAlias)
If smtpok = 0 Then
strAlias=UCASE(Left(firstname,1) & left(middlename,1) &
left(lastname,1)) & LCASE(lastname,2) & "X"
smtpok =
testsmtp(firstname,middlename,lastname,inputdomain,strAlias)
If smtpok = 0 Then
strAlias=UCASE(Left(firstname,1) & left(middlename,1) &
left(lastname,1)) & LCASE(lastname,2) & "XX"
smtpok =
testsmtp(firstname,middlename,lastname,inputdomain,strAlias)
If smtpok = 0 Then
strAlias=UCASE(Left(firstname,1) & left(middlename,1) &
left(lastname,1)) & LCASE(lastname,2) & "XXX"
smtpok =
testsmtp(firstname,middlename,lastname,inputdomain,strAlias)
If smtpok = 0 Then
strAlias=UCASE(Left(firstname,1) & left(middlename,1) &
left(lastname,1)) & LCASE(lastname,2) & "XXXX"
Else
'Do Nothing
End If
Else
'Do Nothing
End If
Else
'Do Nothing
End If
Else
'Do Nothing
End If
'Call ChangeSmtpAddress(strAlias,fullname,site,inputdomain,inputou)
If FirstCharAsci >= AsciA AND FirstCharAsci <= AsciB then
storagegroup=storagegroup1
informationstore=informationstore1
ElseIf FirstCharAsci >= AsciC AND FirstCharAsci <= AsciD then
storagegroup=storagegroup1
informationstore=informationstore2
ElseIf FirstCharAsci >= AsciE AND FirstCharAsci <= AsciH then
storagegroup=storagegroup1
informationstore=informationstore3
ElseIf FirstCharAsci >= AsciI AND FirstCharAsci <= AsciK then
storagegroup=storagegroup1
informationstore=informationstore4
ElseIf FirstCharAsci >= AsciL AND FirstCharAsci <= AsciM then
storagegroup=storagegroup2
informationstore=informationstore5
ElseIf FirstCharAsci >= AsciN AND FirstCharAsci <= AsciP then
storagegroup=storagegroup2
informationstore=informationstore6
ElseIf FirstCharAsci >= AsciQ AND FirstCharAsci <= AsciS then
storagegroup=storagegroup2
informationstore=informationstore7
ElseIf FirstCharAsci >= AsciT AND FirstCharAsci <= AsciZ then
storagegroup=storagegroup2
informationstore=informationstore9
Else
storagegroup=storagegroup2
informationstore=informationstore8
End if
'***Build the LDAP url in order to create the mailbox'***
strLDAPUrl="LDAP://CN=" & informationstore & ",CN=" & storagegroup &
",CN=InformationStore,CN=" & _
exchangeserver & ",CN=Servers,CN=Admin Group,CN=Administrative
Groups,CN=" & inputdomain & _
",CN=Microsoft
Exchange,CN=Services,CN=Configuration,dc=Domain,dc=COM"
bContinue=CreateNewUserMailbox(usr, strLDAPUrl, inputdomain,
testusername)
If bContinue=True then
bContinue2=CreateMailboxFolders(exchangeserver, strAlias,
strPassword)
Else
msgbox "Failed to create Mailbox for this user, please create it
manually"
End If
'write out DB information
set dbupdaters=createobject("adodb.recordset")
dbupdaters.open "Users",conn,2,2,2
dbupdaters.addnew
dbupdaters("firstname")=firstname
dbupdaters("middlename")=middlename
dbupdaters("lastname")=lastname
dbupdaters("accounttype")=AccountType
dbupdaters("homeserver")=homedir
dbupdaters("storagegroup")=storagegroup
dbupdaters("informationstore")=informationstore
dbupdaters("UserID")=testusername
dbupdaters("creator")=username
dbupdaters("Domain")=inputdomain
dbupdaters("Creation Time")=now
dbupdaters.update
txtFirstname.value = ""
txtMiddlename.value = ""
txtLastname.value = ""
txtRefnumber.value = ""
txtRequestor.value = ""
ListAccType.value = "AccTypeStart"
msgbox "Account has been created successfully."
MsgBox "Account Username is: " & testusername & VBCRLF & "Account
Password is: " & strPassword & VBCRLF & "Home Server: " & _
homedir & VBCRLF & "Profile Directory: " & profiledir
set dbupdaters=nothing
set conn=nothing
Set strPassword=nothing
btnRunScript.disabled = false
btnReset.disabled = false
btnClose.disabled = false
end sub
'=================================================================================================================================================
'***Sub and Function to Initiate the Recipient Update Service and
force replication.***
'=================================================================================================================================================
Sub RUS
'This sample finds the first Exchange Organization and
'starts the server RUS. If you have multiple Exchange
'organizations you will want to modify the code.
'This sample does a serverless bind finding the first DC
'to respond. You may want to modify the code to specify
'a specific server in the Bind statement.
Dim RootDse
Set RootDse = GetObject("LDAP://RootDSE")
strdn = RootDse.Get("defaultNamingContext")
Set oConfig = GetObject("LDAP://" & strdn)
strDomainName = oConfig.Get("name")
strConfigurationNC = RootDse.Get("ConfigurationNamingContext")
strExchangeOrg = FindAnyOrg(strConfigurationNC)
strRUS = "CN=Recipient Update Service (" & strDomainName &
"),CN=Recipient Update Services," & "CN=Address Lists Container,CN=" &
strExchangeOrg & ",CN=Microsoft Exchange,CN=Services," &
"CN=Configuration," & strdn
Set objRUS = GetObject("LDAP://" & strRUS)
objRUS.Put "msExchReplicateNow", True
objRUS.SetInfo
End Sub
Function FindAnyOrg(strConfigurationNC)
Set oConnection = CreateObject("ADODB.Connection")
Set oCommand = CreateObject("ADODB.Command")
Set oRecordSet = CreateObject("ADODB.RecordSet")
Dim strQuery
'Open the Connection
oConnection.Provider = "ADsDSOObject"
oConnection.Open "ADs Provider"
'Build the query to find the private Exchange Organization
strQuery = "<LDAP://" & strConfigurationNC & ">;
(objectCategory=msExchOrganizationContainer);name,adspath;subtree"
oCommand.ActiveConnection = oConnection
oCommand.CommandText = strQuery
Set oRecordSet = oCommand.Execute
'If we have an Organization then return the first one
If Not oRecordSet.EOF Then
oRecordSet.MoveFirst
FindAnyOrg = CStr(oRecordSet.Fields("name").Value)
Else
FindAnyOrg = ""
End If
'Clean Up
oRecordSet.Close
oConnection.Close
Set oRecordSet = Nothing
Set oCommand = Nothing
Set oConnection = Nothing
End Function
'=================================================================================================================================================
'***Sub to change the smtp address.***
'=================================================================================================================================================
Sub ChangeSmtpAddress(strAlias,fullname,site,inputdomain,inputou)
Set objUser = GetObject("LDAP://" & fullname & ",OU=users,ou=" &
inputou & ",dc=" & inputdomain & ",dc=Local")
vProxyAddresses = objUser.proxyaddresses
sAddress = "SMTP:" & strAlias & "@" & inputdomain & ".co.uk"
nProxyAddresses = uBound(vProxyAddresses)
Do While (nProxyAddresses <> 2) or (IsNull(nProxyAddresses))
nProxyAddresses = uBound(vProxyAddresses)
vProxyAddresses = objUser.proxyaddresses
Loop
i = 0
Do While i <= nProxyAddresses
email = vProxyAddresses(i)
If Left (email,5) = "SMTP:" Then
ReDim Preserve vProxyAddresses(nProxyAddresses)
vProxyAddresses(nProxyAddresses) = sAddress
objUser.proxyaddresses = vProxyAddresses
objUser.SetInfo
End If
i = i + 1
Loop
objUser.Put "mail", strAlias & "@" & inputdomain & ".co.uk"
objUser.SetInfo
End Sub
'=================================================================================================================================================
'***Check SMTP Alias across the domain.***
'=================================================================================================================================================
function testsmtp(firstname,middlename,lastname,inputdomain,strAlias)
on error resume next
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://ou=" & inputou & ",dc=" & inputdomain & ",dc=COM>"
strFilter = "(&(objectCategory=person)(proxyaddresses=SMTP:" &
strAlias & "@" & inputdomain & ".co.uk"))"
strAttributes = "proxyaddresses,AdsPath"
strQuery = strBase & ";" & strFilter & ";" & strAttributes
objCommand.CommandText = strQuery
Set ADSIRecordSet = objCommand.Execute
strProxy = ADSIRecordSet.Fields("proxyaddresses").Value
errorNum = err.number
errorDesc = err.description
if err.number = 0 then
testsmtp = 0
else
testsmtp = 1
end if
end function
'=================================================================================================================================================
'***Check User name across the domain.***
'=================================================================================================================================================
function testaccount(testusername)
on error resume next
'Check via the WinNT provider as we want the accounts to be unique
across the domain not the OU
set checkuser=getobject("WinNT://" & inputdomain & "/" & testusername
& ",User")
testaccount=err.number
end function
'=================================================================================================================================================
'***Add the user to the groups.***
'=================================================================================================================================================
function addgroups(inputdomain,testusername,AccountType)
On Error Resume Next
strGroup1 = "Group1"
strGroup2 = "Group2"
strGroup3 = "Group3"
strPermGroup = "Group4"
Set User = GetObject("WinNT://" & inputdomain & "/" & testusername &
",user")
Set Group = GetObject("WinNT://" & inputdomain & "/" & strGroup1 &
",group")
If Group.IsMember(User.AdsPath) = TRUE Then
'Do Nothing
Else
strMember = Group.Add(User.AdsPath)
End If
Set Group = GetObject("WinNT://" & inputdomain & "/" & strGroup2 &
",group")
If Group.IsMember(User.AdsPath) = TRUE Then
'Do Nothing
Else
strMember = Group.Add(User.AdsPath)
End If
Set Group = GetObject("WinNT://" & inputdomain & "/" & strGroup3 &
",group")
If Group.IsMember(User.AdsPath) = TRUE Then
'Do Nothing
Else
strMember = Group.Add(User.AdsPath)
End If
If AccountType = "Standard User Account" Then
Set Group = GetObject("WinNT://" & inputdomain & "/" & strPermGroup
& ",group")
If Group.IsMember(User.AdsPath) = TRUE Then
'Do Nothing
Else
strMember = Group.Add(User.AdsPath)
End If
Else
'Do Nothing
End If
end function
'=================================================================================================================================================
'***Create the new users exchange mailbox.***
'=================================================================================================================================================
Function CreateNewUserMailbox(usr, strLDAPUrl, inputdomain,
testusername)
usr.createmailbox strLDAPUrl
usr.setinfo
'Set the Delivery Size Limit for the User to 6Mb
usr.put "submissionContLength", "6144"
usr.SetInfo
Call RUS
sTrusteeName=inputdomain & "\" & testusername
'Get the copy Mailbox Security Descriptor (SD) stored on the
msExchMailboxSecurityDescriptor attribute
usr.GetInfoEx Array("msExchMailboxSecurityDescriptor"), 0
Set oSecurityDescriptor = usr.Get("msExchMailboxSecurityDescriptor")
'Extract the Discretionary Access Control List (ACL) using the
IADsSecurityDescriptor interface
Set dacl = oSecurityDescriptor.DiscretionaryAcl
MsgBox err.number & VBTAB & err.description
AddAce dacl, sTrusteeName, 131073, 0, 2, 0, 0, 0
'Add the modified DACL back onto the Security Descriptor
oSecurityDescriptor.DiscretionaryAcl = dacl
'Save New SD onto the user
usr.Put "msExchMailboxSecurityDescriptor", oSecurityDescriptor
'Commit changes from the property cache to the information store
usr.SetInfo
'MsgBox "Done viewing and modifying the copy of the Mailbox Security
Descriptor"
CreateNewUserMailbox = True
End Function
'=================================================================================================================================================
'***Create the mailbox folders.***
'=================================================================================================================================================
Function CreateMailboxFolders(exchangeserver, strAlias, strPassword)
CreateMailboxFolders = False
'Build the URL to the user's mailbox.
strMailboxURL = "http://" & exchangeserver & "/Exchange/" & strAlias
& "/"
'Build the Domain\Username string.
strUserDomain = inputdomain + "\" + testusername
'Create the XMLHTTP object.
Set oXMLHTTP = CreateObject("microsoft.xmlhttp")
'Open the request object with the GET method. Specify the source
URI,
'that it will run asynchronously, and the username/password of the
'new user.
oXMLHTTP.Open "GET", strMailboxURL, False, strUserDomain, strPassword
'Set the language in which the mailbox folders will be created.
oXMLHTTP.setRequestHeader "Accept-Language", "en-us"
oXMLHTTP.setRequestHeader "Connection", "Keep-Alive"
'Send the GET method request. If the mailbox folders
'have not yet been created, this method will have the side
'effect of forcing the Exchange server to create them in
'the language specified in the "Accept-Language" header.
oXMLHTTP.Send ("")
If (oXMLHTTP.Status >= 200) And (oXMLHTTP.Status < 300) Then
msgbox "Mailbox folders for " & strAlias & " successfully created."
CreateMailboxFolders = True
Else
'GET method did not successfully force creation of mailbox folders.
CreateMailboxFolders = False
End If
Set oXMLHTTP = Nothing
End Function
'=================================================================================================================================================
'***Set the permissions to the mailbox for the user.***
'=================================================================================================================================================
Function AddAce(dacl, TrusteeName, gAccessMask, gAceType, gAceFlags,
gFlags, gObjectType, gInheritedObjectType, inputdomain, testusername)
'Create a new ACE object
Set Ace1 = CreateObject("AccessControlEntry")
Ace1.AccessMask = gAccessMask
Ace1.AceType = gAceType
Ace1.AceFlags = gAceFlags
Ace1.Flags = gFlags
Ace1.Trustee = inputdomain & "\" & testusername
'Check to see if ObjectType needs to be set
If CStr(gObjectType) <> "0" Then
Ace1.ObjectType = gObjectType
End If
'Check to see if InheritedObjectType needs to be set
If CStr(gInheritedObjectType) <> "0" Then
Ace1.InheritedObjectType = gInheritedObjectType
End If
dacl.AddAce Ace1
'Destroy objects
Set Ace1 = Nothing
End Function
'=================================================================================================================================================
'***Close the Script Window.***
'=================================================================================================================================================
sub window_close
window.parent.close
end sub
'=================================================================================================================================================
'***End of the Script.***
'=================================================================================================================================================
-->
</SCRIPT>
<BODY>
<P ALIGN = center>
<img src="C4.jpg" alt="C4"></P>
<BR>
<P ALIGN = center><STRONG>Welcome to the Account Creation Script</
STRONG></P>
<table width="100%" border="0">
<tr><td><table width="100%" border="0">
<tr><th COLSPAN=2><hr>Users Details<hr></th></tr>
<tr><td>First Name:</td><td><input type="text" id="txtFirstname"
size="30"></td></tr>
<tr><td>Middlename:</td><td><input type="text" id="txtMiddlename"
size="30"></td></tr>
<tr><td>Lastname:</td><td><input type="text" id="txtLastname"
size="30"></td></tr>
<tr><td>Reference Number:</td><td><input type="text"
id="txtRefnumber" size="30"></td></tr>
<tr><td>Requestor:</td><td><input type="text" id="txtRequestor"
size="30"></td></tr>
<tr><td>Please select the Account Type for this user account:</
td><td>
<select name = "ListAccType">
<option value="AccTypeStart">Please Select</option>
<option value="Standard User Account">Standard</option>
<option value="Fixed Term Contract User Account">Fixed Term
Contract</option>
<option value="Non-Person User Account">Non-Person Account</
option>
</select>
</td></tr>
</table>
</td></tr>
<tr><td> </td><td> </td></tr>
<tr><td><P ALIGN = center><input type="button" id="btnRunScript"
value="Create Account" onclick="btnRunScript_click"><input
type="button" id="btnReset" value="Reset"
onclick="btnReset_Click"><input type="button" id="btnClose"
value="Close" onclick="window_close"></P></td></tr>
<tr><td></tr></td>
</table>
</BODY>
</HTML>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Many Thanks In Advance Tag: Defrag Hard Disks Tag: 211368
kill process (I don't know the ID)
hello ng
how I can kill a process with a script.
I don't know the ID.
I know the name of the program: ttermpro.exe
thanks Tag: Defrag Hard Disks Tag: 211366
VBS for reading Message Table in dll file
Hi Scripting Guys!
I query the eventlog with the MS Log Parser. The output contains constants
like %%2048. These constants stands for entries in the responding message
table.
For example the msobjs.dll contains the message table for the security
eventlog.
Does anyone has an example how to get the messages from the table with a
vbscript?
Thx!
Marco Tag: Defrag Hard Disks Tag: 211365
Language Bar
Hello everybody,
If anybody can point me to a piece of documentation regarding scripting
language bar management (I need to add two languages (EN(Canada) and
FR(Canada) and remove EN(US) and change French keyboard layout).
Thanks in advance!
-Alex Tag: Defrag Hard Disks Tag: 211361
Script this - Configure ASP.NET to use specific version of .Net Fr
I was reading the IIS documentation and I noticed it's possible to configure
a website to use a specific version of the .Net framework.
For example I have websites that use .Net 2.0 and 1.1
However I want to upgrade the 1.1 websites to 2.0 but I would like to do it
via WMI or ADSI but I don't see any examples in the documentation, only a
reference to using Aspnet_regiis.exe
If anyone knows where I can find an example or if you would like to provide
an example feel free to do so. Thanks in advance
I am using Win2K3 servers Tag: Defrag Hard Disks Tag: 211358
Disable DLL has been successfully registered?
I am running a script to register a DLL and I was wondering if anyone knew a
way to disable the message that the DLL has been registered successfully...
does anyone know if there is a way to do that?
Thanks
Gavin... Tag: Defrag Hard Disks Tag: 211357
resize IFrames
How I can that? I use the following script:
function adjustFrame(){
window.frames.IFrame1.scrollBy(0,250);
currTop = window.frames.IFrame1.document.body.scrollHeight;
if (currTop > 0)
{
currHeight =
document.getElementById('dynFrame').getAttribute('height');
currHeight++;
document.getElementById('dynFrame').setAttribute('height',currHeight);
adjustFrame();
}
}
but the IE show error "Access Denied".... Tag: Defrag Hard Disks Tag: 211354
Remove CRLF while using writeline
Hi all,
>From other posts I've got the code below to delete lines beginning
with xyz (I've actually got about 5 different types so I loop it) and
I've added the line to remove carrigage return and line feeds. However
I can't remove the line feeds.
Does write line always produce a CR so I need another method?
Thanks,
Ed
strCheckForString5 = UCase("xyz")
'Remove line if begins with xyz
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName,1)
strContents = objTS.ReadAll
objTS.Close
arrLines = Split(strContents, vbNewLine)
Set objTS = objFS.OpenTextFile(strFileName,2)
For Each strLine In arrLines
If Not(Left(UCase(LTrim(strLine)),Len(strCheckForString1)) =
strCheckForString1) Then
strline = Replace(strline, vbCrLf, " ")
objTS.WriteLine strLine
End If
Next Tag: Defrag Hard Disks Tag: 211353
LDAP Question
I am trying to create a script that will pull the logon user name then
perform a LDAP query to find users homedrive and other attribut information.
For example:
Set objNet = CreateObject("WScript.NetWork")
struser = ucase(objNet.username)
Set objUser = GetObject("LDAP://CN=" & struser & ",OU=Users,DC=test,DC=com")
strhdir = objUser.HomeDirectory
msgbox(strhdir)
But this does not work because the logon username is "JDDoe", but in order
to get this to work I have to use "Doe\, John" in the cn to get this to
work.
Is there any way to automaticall convert the logon username to the cn name.
Mike Tag: Defrag Hard Disks Tag: 211352
Remotely shutting down a Vista PC.
Is there a way to remotely shut down a Vista PC through a script?
I have two PCs on my network. I run Windows Small Business Server 2003 on
one PC and Vista Ultimate 64-bit on the other and the Vista PC is part of the
SBS domain. I have a UPS that's managed by SBS. When the UPS is about to
shutdown SBS when it's battery is low, the UPS management software has the
option to run a batch file on SBS. I would like to invoke a script from the
batch file to forcefully shutdown the Vista PC.
How do I do this?
Thanks. Tag: Defrag Hard Disks Tag: 211347
File Copy with FSO
I am doing a file copy using the FSO and have recently started seeing a
condition being met.
The copy job copies DB logfiles from one server to another but checks for
the LastModifiedDate and if it is the same as well as the size of the file
is the same, the script goes onto the next file.
If the sourcefile is newer than the target file, it copies the sourcefile to
the target location, overwriting the targetfile.
However, I am also catching if the targetfile is newer than the sourcefile
and this is where my problem is. I am finding a number of files where the
targetFile's LastModifiedDate is more recent by 1 second. The Month, Day and
Year are all the same, and not recent, but the time is 1 second newer.
If targetFile is being modified by my script, I would expect the modified
date to be more recent than it is -- the time of the copy.
This exact script is running on a number of log files copy processes but
this is the only one I am having this issue with.
Has anyone seen this issue happen when doing file copies?
Bart Perrier Tag: Defrag Hard Disks Tag: 211346
EML file parser script
does someone know how to make vbscript that will parse EML files stored in
one folder: just search for specific sender name in 'From:' field and store
this email separately.
Regards,
Santander Tag: Defrag Hard Disks Tag: 211343
Disabled Account - [WP]
I am looking for a vbscript.
When we run that script it should disable the AD user account and remove the
mailbox from it and if possible move the removed mailbox to a specific
Storage Group?
Any ideas.
Thank you. Tag: Defrag Hard Disks Tag: 211342
objComputer.UserName value is empty
When running this script the objComputer.UserName value is empty
Option Explicit
Dim objWMIService, objComputer, colComputer, strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName & " is logged on"
Next Tag: Defrag Hard Disks Tag: 211341
Error when creating user with mailbox in script
Hope someone can help here, and this is the right group :-)
I have a periodic problem when creating mail-enabled users using a
VBscript:
-2147467259 - There is no Connection Agreement configured to export this
recipient to the Exchange 5.5 server.
I'm creating using Microsoft best practicies, descriped in this article:
http://support.microsoft.com/kb/327079
If I try running the script several times it completes with sucess, but this
is not a valid solution.
The enviroment:
Windows Server 2003 AD
Exchange 2003 standard, SP2
Looking forward to hear from you, as this i a very critical issue for our
solution.
Best wishes
Bo Berggreen Tag: Defrag Hard Disks Tag: 211339
I need a script (pref VB) to change permissions on a folder in multiple folders.
I need a script (pref VB) to change permissions on a folder in multiple
folders.
Example, imagine users home directory, so a folder contains all the users.
Each user has a folder inside their home directory called 'examples'. I need
a script to search for that folder inside each users home directory and
change the permissions to 'read, list folder contents'
Can this be done?
This is not being done on users home directories but this was the best
example I could give.
Or imagine their are 10 folders named 1 to 10. inside each folder are 5
folders named A,B,C,D and E. I want a script to search for the folder named
'D' and change the permission on that folder only. Tag: Defrag Hard Disks Tag: 211319
UserAccounts.CommonDialog alternative for Vista?
I sell an application that supports vbscript in it's forms, and on
some I use UserAccounts.CommonDialog to display a File Open dialog so
a user can select a filename.
On Vista, this functionality is not available. My question: is there
an alternative for Vista that does not require distributing any
additional controls?
Some background info:
My searches so far revealed that the following alternatives are
available, none of them are very appealing
-Using MSComDlg.CommonDialog, which requires installing the Common
Dialog control, which is subject to licensing
-Using SAFRCFileDlg.FileSave, which also requires installing an
additional control, and which is deprecated and not originally
intended for use in scripting in the first place.
-Using Choose File HTML File Control Object, a workaround that
(ab)uses IE, that I find inventive but very ugly..
tia,
arno Tag: Defrag Hard Disks Tag: 211315
Troubleshooting an attempt to open connection
I need some help with troubleshooting.
When I execute my vbs script in a DOS environment it runs OK. But
when it is called by an asp calling client, it does not work and does
not indicate why.
I put some tracing statements to find out where it errored and it
echoes Point1 and Point2 but never reaches Point 2A. So I guess the
open connection must have failed.
1. What should I do to handle a connection error? On error resume
next seems strange...
2. Is my connection open statement incorrect? What should it be?
3. Again I'm confused when all players are vbs scripts, it runs OK.
When an asp client calls it, it simply does not work.
Thanks
Set objTHoldCon = CreateObject("ADODB.Connection")
Set objTHoldCom = CreateObject("ADODB.Command")
WScript.Echo "Point1"
'Opening the connection
objTHoldCon.Open "audit","sa","password"
WScript.Echo "Point2"
'assigning the command object parameters
Set objTHoldCom.ActiveConnection = objTHoldCon
objTHoldCom.CommandText = "usp_Thresholds_GetStatus"
objTHoldCom.CommandType = adCmdStoredProc
WScript.Echo "StatusHelper Point2a" Tag: Defrag Hard Disks Tag: 211301
I am looking for an HTA exit code function like wscript.quit()
I have moved to using HTA scripts but I can't figure out how to send an exit
code back to the calling app. In vbscript I was able to do this with wscript.
quit(code). This function will not work in HTA. Is there a way to pass the
exit code back from an HTA?
Thanks Tag: Defrag Hard Disks Tag: 211298
What VBScript interpreters are available? ...
If I create some simple VBScripts that only do file I/O and
manipulation in a text editor, what do I need to execute them?
Is there some kind of simple interpreter or run-time environment I can
download from Microsoft?
Thanks again!
Chris
http://amateureconblog.blogspot.com/ Tag: Defrag Hard Disks Tag: 211286
Newbie needs some recommendations ...
Hello everyone, I'm new to this group. ;-)
I used a bit of VB "back in the day" (VB 3, 4, and 6), but I'm
somewhat out of practice. ;-)
I'm beginning to use a testing tool that has VBScript as its built-in
scripting language.
Can you recommend a good VBScript book or web site(s)?
Are there any good tutorials or language references available as
PDFs?
All advice appreciated ...
Thanks very much in advance!
Chris
http://amateureconblog.blogspot.com/ Tag: Defrag Hard Disks Tag: 211285
RegEx question
I have a problem parsing "first.lastnamer@calif.usa.mycompany.com" into
seperate domain parts. I've tried using "\w*(?x)" but it generates an error
in VB. I need the domain parts for the logic in my script, can someone help
with this?
Thanks,
Scott Tag: Defrag Hard Disks Tag: 211282
HTA Exit Code
Hello, I have been using the wscript.Exit() in my vbscripts for some time to
return the status of my scripts to the calling app. I have started using HTA
and I can not figure out how to get the same funtionality. With out a return
code to my calling app my HTA app is of no use to me. I have done some
searching and found that the object used for Wscript.exit can't be used in
HTA but there has to be a way to set an exit code.
Please help :(
Thanks in advance. Tag: Defrag Hard Disks Tag: 211272
HP Desktop for sale!
Hi,
I have an unused HP Pavilion with the fallowing specs:
# Processor: AMD Athlon 64 X2 4000+ (2.1GHz, 2000MT/s System Bus)
# Memory: 2048MB PC2-5300 DDR2 SDRAM memory (2x1GB) (expandable to 8 GB (4 x 2 GB) (64-bit OS)/ 4 GB (4 x 1 GB) (32-bit OS))
# Hard Drive:320GB 7200RPM SATA 3G (3.0 Gb/sec) hard drive
# Optical Drive: 16X DVD(+/-)R/RW 12X RAM (+/-)R DL LightScribe SATA drive
# Expandable Drive Bay: HP Pocket Media Drive bay
# Video Graphics: Integrated graphics
# Network Interface: Integrated 10/100BaseT network interface
# Sound: High Definition 8-channel audio
# Fax/Modem: 56K bps data/fax modem
# Operating System: Genuine Windows Vista® Home Premium
This is "used" but basically brand new (it has literally been on for no more than 6 total hours..) is only 1 month old..
PRICE: $425 OBO
Email- pbdude911@yahoo.com Tag: Defrag Hard Disks Tag: 211268
Watch NFL Games Online
Watch NFL Games Online!
For every one who wants to watch the games online because they dont live in the teams town or are at work i found a site that has basically every game covered. Its perfect if you have afford a monthly $70 direct tv nfl access subscription. they got a bunch of channels
The sites http://nflonline.wizhoo.com Tag: Defrag Hard Disks Tag: 211267
Fatloss computer program
I have been using this computer program for a couple weeks now and i am very pleased with the results so far. its a software fatloss program, if your looking for a diet/weightloss plan i reccomend you check this place out first: http://fatloss9.50webs.com Tag: Defrag Hard Disks Tag: 211266
scheduled tasks
Hi All,
I have a vbscript that has 2 command line parameters
It runs fine from the shortcut or "Run" with the command
line
myscript.vbs para1 para2
However, when I put it in the Scheduled Tasks, it does not
work.
To make it work I have to put "...\wscript.exe
..\myscript.vbs para1 para2
Is there any way to avoid having to use "wscript" ?
Thanks
al Tag: Defrag Hard Disks Tag: 211261
Error while using impersonation to manage a service remotely
This script worked last week, and now it doesn't. I don't know what
has changed, but I know the script hasn't changed.
The portion that's failing can be run alone:
-=-=-=-
Set oService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\
\SERVERNAME\root\cimv2:Win32_Service.Name='SERVICENAME")
oService.stopService
-=-=-=-
I'm running it as privileged admin, the same way I ran it last week
when it worked. Now it gives me a dialog box titled "Windows Script
Host" with this data:
Script: [path to script]
Line: 3
Char: 1
Error: A security package specific error occured.
Code: 80070721
Source: (null) Tag: Defrag Hard Disks Tag: 211257
change file type...
hey, guys and gals. i'm in the process of compiling a script that
pulls some info on users in active directory, change the resulting
logfile from a csv to an xls spreadsheet, and then mine more data
using a different search method based on the results of the first
query. i have the query parts working, but it craps out when i try to
change the file type. did i mention that i know just enough vb to
annoy you experts? thanks in advance. early on in the script, i
define the logfile:
' Determine local path.
strScriptPath = Wscript.ScriptFullName
strScriptName = Wscript.ScriptName
strScriptFolder = Left(strScriptPath, Len(strScriptPath) _
- Len(strScriptName) - 1)
' Log file name.
strLogFile = strScriptFolder & "\ContractorsLastLogons" _
&