Missing home dir when account created by vbscript
When I create an account using vbscript I also create the home dir for the
user and populate the homeDir properties of the account. There are no errors
creating the directory and there are no errors populating the homeDir
property of the account. Using Active Directory Users and Computer (ADUC) I
can see that the account was created and that the home dir was set properly.
Checking the drive for the dir reveals it is created and the rights are
assigned correctly.
The problem is at login. When you login with one of these accounts the user
does not get a mapping to their home dir. Yet if they use the run cmd they
can open the dir and utilize it.
We suspect it has something to do with what gets input to the homeDir
property but I'm unable to determine that there is anything wrong with it.
Interestingly if I modify the home dir property in ADUC (so the apply button
becomes active) and then switch it back to what was there then click apply,
when the user logs in their home dir appears correctly for them.
Any ideas? Tag: vb script to change pagefile to system managed Tag: 191260
Filtering via OU
Hi folks,
Quick question. I wish to do a search on a whole domain, but I wish to
exclude specific domains.
My current search is this:
' Retrieve lastLogon attribute for each user on each Domain Controller.
For k = 0 To Ubound(arrstrDCs)
strBase = "<LDAP://" & arrstrDCs(k) & "/" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "distinguishedName,lastLogon,description"
strQuery = strBase & ";" & strFilter & ";" & strAttributes &
";subtree
(thanks to Richard Mueller for large bits of the script)
Basically, I wish to exclude say two OUs called OU=disabled
users,DC=domain,DC=com & OU=resource accounts,OU=users,DC=domain,DC=com
- how is this done? I can get a filter using "memberof", but that is
member of a group rather than a member of a OU sadly.
Thanks in advance!
Rich Tag: vb script to change pagefile to system managed Tag: 191256
Methods to use with the registry
Hi,
I've used this line before:
If objFSO.FileExists("C:\Program Files\Microsoft
Office\Office10\Winword.exe") Then
Is there a method similar to this to check if a registry value exists?
Thanks in Advance,
JeffH Tag: vb script to change pagefile to system managed Tag: 191248
Import a third party root certificate
Hello,
can I generally import a x509 certificate into ca. 350 Windows -Client using
a script ?
Thanks
Peter Tag: vb script to change pagefile to system managed Tag: 191247
Editing txt file.
Hi!
Here's what I need to do:
I have a text file of 141 lines which contains data considering
web-application. In line 5 of the txt-file, the username is introduced.
Now I would need a script, which would ask me the username, and then
the script would modify the Username section, in the line 5 of the
text-file.
So basicly I would need a "Username" -variable. The value of "Username"
would be entered by a user, and then the script should input the value
to the text file.
Do you have any ideas which would be an easy way to accomplish this? It
seems that FileSystemObject cannot modify text-files, is that right?
Thanks in advance,
Henri Tag: vb script to change pagefile to system managed Tag: 191245
sorry but i have an exchange 5.5 question :(
i need to write a script that would be simple for exchange 2000 or 2003, but
i have to run it against a 5.5 org.
the script only has to list all mailboxes on a particular server, and the
current size of the mailbox. ill make it write to a spreadsheet, but does
anyone know how i can get the info from 5.5 with vbscript?
thank you very much Tag: vb script to change pagefile to system managed Tag: 191242
variable construction from ASP form values
Hi all--
I am trying to handle a series of indexed values passed via "post" from
a form on an ASP page. Could someone explain why the following code
separates variables with "<br>" but seems to fail with ", "? When I
change the line indicated by "<===****" I only get the first value.
Interestingly, changing "<br>" to "<, >" gives me "[value]<, >[value]<,
>[value]<, >".
Result (separating with "<br>"):
"Value list: 3
5
7"
Result (separating with ", "):
"Value list: 3"
And how I can construct a variable in the format "[value], [value],
[value], "?
Thanks!
steve
===== code from ASP file ====
<%option explicit%>
<html>
<body>
<%
dim lngTotal, strSelected, i
lngTotal = Request.form("SelCat").Count
strSelected="Value list: "
For i = 1 To lngTotal
strSelected=strSelected & Request.form("SelCat")(i) & "<br>" <===****
Next
Response.Write("<br>")
response.write(strSelected)
%>
</body>
</html> Tag: vb script to change pagefile to system managed Tag: 191241
Retrieve Parameter from location bar
Hi Everybody
I have an Access database that passes a Parameter to a web page
something like this.
http://localhost/index.htm?paramName=1234-54321
I want to be able to retrieve the parameter (In this example
1234-54321) and pass it to a hidden text box on a form. Something like
the one below...where it says <IN HERE>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="item_number" value="<IN HERE> Upgrade from
Free Version to Standard Version">
</form>
I am a VBscript Virgin so please be gentle with me.
Any help gratefully received
Bob Tag: vb script to change pagefile to system managed Tag: 191239
Extracting Name Value Pairs
Hi I have a long line of text that I want to parse for name/value pairs
see example below
( note:
- it is a one long line so please remove linebreaks, and
- I have replaced tabs with the pipe for clarity)
I am trying to regex to extract the name/value pairs; perhaps I could just
use a split function (this just occured to me as I pasted the example below.
Nevertheless, can i use RegEx to extract name value pairs?
the pattern i am came up with (whch I bet could be improved) is
Patrn1 = ""
Patrn1 = Patrn1 & "\t*([\w]+)\t([\w \/\x22]+)\t*" ' first value pair
Patrn1 = Patrn1 & "\{\t*(Alignment)\t([\w \x22]+)" 'second value pair to
account for the bracket; I suppose I could replace it with nothing
Patrn1 = Patrn1 & "(\t*([\w]+)\t([\w \x22]+))+" 'third value pair, which
should repeat but does not...
thanks in advance for your assistance.
Regards
Habib
------------------------------
||||ReportCalculatedField|"328"||||||||{|||||Alignment|"right"|||||BackColor|"Transparent"|||||CalculatedField|"Apply
Bucket
1"|||||DisplayOptions|"HideWhenEmpty"|||||DisplayType|"Data"|||||Font|"Helvetica
(generic)"|||||FontBold|"false"|||||FontColor|"Black"|||||FontItalic|"false"|||||FontSize|"7"|||||FontUnderline|"false"|||||Format|""|||||FormatField|"'Func/Rept
Index'"|||||Pattern|"(none)"|||||PatternColor|"White"|||||PositionLeft|"365"|||||PositionTop|"256"|||||ReadingOrder|"LeftToRight"|||||SizeHeight|"8"|||||SizeWidth|"72"|||||ZOrder|"116"||||}
------------------------------
--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 21
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input. Tag: vb script to change pagefile to system managed Tag: 191235
Newbie scripting. Modifying the registry.
I have been assigning nic speeds for a couple years on all new boxes
that we build in our datacenters manually. I finally got fed up and
picked up some vbscript books which have been a great help managing
some redunant tasks i must do, but this one stumps me.
Key Name:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
Under each subkey there is a string value of "SpeedDuplex" with a value
ranging from 0+
100/full is 4 auto/auto is 0
If the device is not a physical hardware nic, it will not have the
SpeedDuplex Key, which is a plus for finding real devices vs
virtual/software ones.
What I am trying to do is run through each subkey and its strings and
change any that have a string of "SpeedDuplex" with a value of 0 to 4.
Im not sure about how to loop through all the keys to do this.
Any help would be appreciated.
Thx
C Tag: vb script to change pagefile to system managed Tag: 191234
cannot pass LDAP query with "/"
Hi there,
i just need some help with an LDAP Query.
I am writing a VB Script that prints out all the members of a
Distribution list/Security group, and also prints out their details
such as name, email, title, etc for security purposes.
I am experiencing a problem when trying to print out the members on a
DL called:
"All Managers/Directors"
The problem seems to be with the "/" in the DL's name, as all other
groups without the "/" work fine.
The full Distingushied name of the object is:
CN=All Managers/Directors,OU=Contacts DL,OU=Distribution Lists,
DC=xxx,DC=xxx,DC=xxx,DC=xxx
the LDAP Query wont find the object..The ldap query is as:
'use ASCII char "47" to replace "/" in DN
strGrp = "CN=All Managers" & chr(47) & "Directors,OU=Contacts
DL,OU=Distribution Lists,DC=xxx,DC=xxx,DC=xxx,DC=xxx"
Set objGroup = GetObject _
("LDAP://" & strGrp)
objGroup.GetInfo
when i run this i get the following error:
C:\prntSecGrp.vbs(22, 1) (null): 0x80005000
I have run this with the ASCII char and without, both with no luck. Any
help would be greatly appreciated!
Regards
K. Tag: vb script to change pagefile to system managed Tag: 191233
XCopy using If and Then Statements
New to this, and I don't quite comprehend something.
I need a batch file that copies SPECIFIC files from a Network Directory to
C:\123_Software\ folder.
@ECHO OFF
Rem Copy \\ServerName\123_Software to Clients \123_Software folder.
XCOPY \\servername\123_Software\ABCD.EXE C:\123_Software\ /S /E
XCOPY \\servername\123_Software\1234.EXE C:\123_Software\ /S /E
XCOPY \\servername\123_Software\XYZ.EXE C:\123_Software\ /S /E
The difficulty is this:
I am tying this to a GPO which works just fine, but I want to ensure I am
not sending these files to each client everytime they log into the etwork.
As these files are 13.5 MB, 9.5 MB, and 1.5MB.
What I need is something that looks to see if File on Client Machine has the
same date and time as file on Network, then go to next file.
Either a Batch file, or a VBS script will work perfectly. Tag: vb script to change pagefile to system managed Tag: 191232
Finding out who modified a file
Is there any way of finding out *who* modified a particular file using
VBS? It's in a W2K domain, but it's on a PC that's not running W2K
Server, just plain W2K. Tag: vb script to change pagefile to system managed Tag: 191231
schtasks - how to?
I am trying to run the following:
schtasks /CREATE /Tn "Startup Tasks" /Tr "cmd /V:on /C
\"C:\startup\StartupTasks.cmd \" AUTO" /SC ONLOGON
However I need the start in folder to be 'startup' not 'cmd' as it seems to
always be set to. I know you can change it with the gui, but I really would
much prefer to do at the command prompt. Is it possible?
btw the reason I am using the cmd is so I can set /V:on - I don't want to
have to do this in the registery.
Cheers, Tag: vb script to change pagefile to system managed Tag: 191229
Open Handle
Hi
Is it possible as in computer management to view open handles in vbscript ? Tag: vb script to change pagefile to system managed Tag: 191224
Running Remote Processes (2000 PC to XP PC)
Hi,
I am trying to run this script from MSDN to start a remote notepad on an XP
workstation. I am running the script from a Win2K Server. It fails with error
3 "Insuffiicient privilege" It runs fine from XP to 2000.
Here is the code.
Const SW_NORMAL = 1
strComputer = "remoteWstn"
strCommand = "Notepad.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate & authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")
' Configure the Notepad process to show a window
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = SW_NORMAL
' Create Notepad process
Set objProcess = objWMIService.Get("Win32_Process")
intReturn = objProcess.Create _
(strCommand, Null, objConfig, intProcessID)
If intReturn <> 0 Then
Wscript.Echo "Process could not be created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Return value: " & intReturn
Else
Wscript.Echo "Process created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Process ID: " & intProcessID
End If
This is taken from the following link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/create_method_in_class_win32_process.asp Tag: vb script to change pagefile to system managed Tag: 191220
csv/excel file
Hello there,
I know this is a wrong place.
I have an csv file of sAMAccountNames of 50 users. They are all scattered
in different OUs in a domain.
I would like to retrive homeMDB attribute of these users.
Does anybody have a sample script or atleast direct me to right place?
Second question:
How do I executive another vbscript from withing a vbscript?
for example, I want to write a vbscript that executives c:\test.vbs >>
test.txt
Thanks in advance Tag: vb script to change pagefile to system managed Tag: 191219
DHCP
The snippet below is directly from the Portable Script Center. Works great
locally and as a login script (removing the echo's of course).
My question is what is the point of the strComputer = "." line? Or rather
the "." on that line. I know the "." indicates the local PC, but I've been
under the impression that you could enter a remote machines name (on the same
network) instead of the period, and the script would apply to that remote
machine. However, it doesn't work that way. I've tried other scripts like
the reboot script that don't work either. If all the script apply to the
local machine anyway, why do we need the strComputer = "." line?
Can anyone update me as I appear to be misinformed?
---------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
Next
--------------
Thanks for any help or suggestions!
-Steve Tag: vb script to change pagefile to system managed Tag: 191216
Shinbaum or Anyone...
Hi Shinbaum or Anyone...
Can you help to create a function to destroy connection as Shinbaum
sad??
http://groups.google.com.br/group/microsoft.public.scripting.vbscript...
Please look this topic... Tag: vb script to change pagefile to system managed Tag: 191212
SCHTASKS help
I'm trying to schedule a task with SCHTASKS. I'm having trouble
creating it. Here's how I attempt to create it.
schtasks /Create /SC DAILY /ST 10:29:00 /TN "myTaskName" /TR
"C:\myBatchFile"
After executing that, I am prompted to
"Please enter the run as password for USER:"
I don't know what that is, so I just make one up. I am warned that it
may not run correctly, and it doesn't run correctly.
Is there a way to skip the password thing? This is a public computer,
so I don't want to bog things down with passwords.
Thanks! Tag: vb script to change pagefile to system managed Tag: 191208
Enable Active X Controls
Hi All,
I need a script that will enable active x controls for all sites in IE.
I'm having trouble finding such a script..anyone have any idea?
I have had a look around and i have seen this document but i am unable
to find anything else.
http://www.codecomments.com/message241814.html
Cheers,
--
HoinK
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: vb script to change pagefile to system managed Tag: 191207
Enable Active X Controls
Hi Guys,
I have a need for a script to enable active x controls for all trusted
sites in IE. I have searched the forum and i've come up with this:
http://www.codecomments.com/message241814.html
I'm totaly new to VB and i was hoping someone would have the sort of
script that i need.
Thanks
HoinK
--
HoinK
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: vb script to change pagefile to system managed Tag: 191206
How to create a Kernel Service ?
Hi,
I try to create a kernel service with WMI
I use this function:
Sub CreateService(sName, sDisplayName, sPath, sTypeSrv, sType,
strInteractif, strUser, strPassword)
Const OWN_PROCESS = 16
Const NORMAL_ERROR_CONTROL = 0
Const KERNEL = 1
Const FILSYSTDRV = 2
Const SHAREDPROC = 32
Const INTERACT = 255
Dim TypeSrv, User, Password, Interactif, Result, t
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objService = objWMIService.Get("Win32_BaseService")
IF strUser = "" THEN
User = "NT AUTHORITY\LocalService"
Password = ""
ELSE
Password = strPassword
END IF
IF Ucase(strInteractif) = "YES" THEN
Interactif = TRUE
ELSE
Interactif = FALSE
END IF
Select Case Ucase(sTypeSrv)
Case "KERNEL" TypeSrv = KERNEL
Case "FILE SYSTEM DRIVER" TypeSrv = FILSYSTDRV
Case "SHARED" TypeSrv = SHAREDPROC
Case "INTERACTIF" TypeSrv = INTERACT
Case Else TypeSrv = OWN_PROCESS
End Select
Result = objService.Create
(sName,sDisplayName,sPath,TypeSrv,NORMAL_ERROR_CONTROL,sType,Interactif,User,
Password)
end sub
I call this function by this way:
CreateService
"test","test222","C:\Winnt\hardlock.sys","KERNEL","Boot","YES","",""
But I have Error 21 which means "Invalid parameters"
I try to create not a kernel service, and it works successfully.
Do you have any ideas for my issue ?
Thanks for replies Tag: vb script to change pagefile to system managed Tag: 191205
resolution + vbscript
I'm trying to change resolution settings with presentation direstor
using vbscript. is there any way to apply the new scheme immmediately
as its created, through a script
The first 3 statments create the scheme and add them to presentation
director , but it will not aplly them , even though the apply
immediately box is ticked . Can anyone help please
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oShell
oShell = CreateObject("WScript.Shell")
oShell.run("regedit /s c:\resolution\npdirectdd.reg")
oShell.run("regedit /s c:\resolution\dualdisplay.reg")
oShell.AppActivate("NPDTRAY.exe")
oShell.SendKeys("{ENTER}") Tag: vb script to change pagefile to system managed Tag: 191201
Set printer profile
Hi all,
I'm trying to set a profile (E5-color) as default profile in a printer
called "DALI".
Can this be done with vbscript ?
Probabely it's a registry key to set, but which one ?
Greetz,
Woef. Tag: vb script to change pagefile to system managed Tag: 191192
Setlocal equivalent
Hello world,
is there a VBScript equivalent to setting environment variables locally
in a batchfile? I wnat do to something like
setlocal
set path=<...>
set <xxx>=<yyy>
run_my_app
endlocal
but I'd like to use VBScript (.vbs) rather than a batchfile.
Jens Tag: vb script to change pagefile to system managed Tag: 191190
Simple HTA question
I couldn't find any HTA-specific newsgroups so please forgive me if this
post isn't relevant to this newsgroup.
I have a an HTA with embedded vbs and wsh. The HTA has 2 textboxes and a
submit button and I'd like the focus to be on the first textbox when the HTA
is launched (so the user doesn't have to click or tab to get there). Anyone
know how to do this? Here's the code for the first textbox:
<input type="text" name="login" size="30" tabindex="1">
If there's a more appropriate newsgroup for this question please let me
know.
Thanks... Tag: vb script to change pagefile to system managed Tag: 191180
Renaming files in a folder
I have a folder with files named 20060408AL.txt, 20060409AL.txt,
20060410AL.txt, etc. The files use the date and add an "AL" to the end. Can
someone help me with a script that renames each file within a folder and
"strips" the "AL" part at the end?
The end result would convert 20060417AL.txt to 20060417.txt. Tag: vb script to change pagefile to system managed Tag: 191179
How can i use connection pooling with hta (vbs)?
I heard about connection pooling in serverside vbscript (asp) but is it
possible to use it with hta? Any example codes?
Thank you
P.S.
exactly my problem is can not able to connect the same data base
(access) from different machines at the same time on my intranet... Tag: vb script to change pagefile to system managed Tag: 191178
Cannot run vb script as domain user
Hi all:
I was wondering if anyone can help me figure out why I am getting a
"Permission denied: 'Get Object' " error message when I try to run a
logon script created using vb. Below is a copy of the script. It
seems that I'm getting this error at the very end. Can anyone tell me
exactly where the permissions need to be set and what permissions are
needed? I have the Windows 2003 default permissions and it is still
not working.
Option Explicit ' Force explicit declarations
'
' Variables
'
Dim RCKNetwork
Dim FSO
Dim strUserName ' Current user
Dim strUserDomain ' Current User's domain name
Dim strDFS ' Path to the DFS root
Dim strDepartment ' Current User's Department
Dim strLDrv ' Current user's L: Drive location
Dim strSDrv ' Current user's S: Drive location
Dim ObjGroupDict ' Dictionary of groups to which the user belongs
Dim AllDrives ' A listing of all drives that already exist
Dim MapLDrive ' Used to determine is user will have a L: Drive
Dim i
Set RCKNetwork = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set AllDrives = RCKNetwork.EnumNetworkDrives()
strUserName = RCKNetwork.UserName
strUserDomain = RCKNetwork.UserDomain
strDFS = "\\RCKDOMAIN\Shares\"
strLDrv = "\\192.168.20.15\" & strUserName
' Read the user's account "Member Of" tab info across the network
' once into a dictionary object.
' Test for L:, Q:, S:, U:, & Z: then delete them if they exist
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = "L:" Then RCKNetwork.RemoveNetworkDrive "L:",
True, True
If AllDrives.Item(i) = "P:" Then RCKNetwork.RemoveNetworkDrive "P:",
True, True
If AllDrives.Item(i) = "Q:" Then RCKNetwork.RemoveNetworkDrive "Q:",
True, True
If AllDrives.Item(i) = "S:" Then RCKNetwork.RemoveNetworkDrive "S:",
True, True
If AllDrives.Item(i) = "U:" Then RCKNetwork.RemoveNetworkDrive "U:",
True, True
Next
Set ObjGroupDict = CreateMemberOfObject(strUserDomain, strUserName)
MapLDrive = TRUE
strDepartment = ""
' Admins, do not have an L: drive
If MemberOf(ObjGroupDict, "Domain Admins") Then MapLDrive = FALSE
If MemberOf(ObjGroupDict, "Help Desk Admins") Then MapLDrive = FALSE
' Find Current User's Department
If MemberOf(ObjGroupDict, "Accounting Group") Then strDepartment =
"Accounting"
If MemberOf(ObjGroupDict, "Marketing Group") Then strDepartment =
"Marketing"
If MemberOf(ObjGroupDict, "Finance Group") Then strDepartment =
"Finance"
If MemberOf(ObjGroupDict, "Research Group") Then strDepartment =
"Research"
' Map the S: Drive
strSDrv = strDFS & "Departments\" & strDepartment
If strDepartment <> "" Then RCKNetwork.MapNetworkDrive "S:", strSDr
' Now we will map all Custom Drives
If MemberOf(ObjGroupDict, "Domain Admins") Then
RCKNetwork.MapNetworkDrive "P:", strDFS & "Software\APPS"
If MemberOf(ObjGroupDict, "Help Desk Admins") Then
RCKNetwork.MapNetworkDrive "P:", strDFS & "Software\APPS"
If MemberOf(ObjGroupDict, "Audit Group") Then
RCKNetwork.MapNetworkDrive "Q:", strDFS &
"Departments\Accounting\Audit"
If MemberOf(ObjGroupDict, "Sales Group") Then
RCKNetwork.MapNetworkDrive "Q:", strDFS & "Departments\Marketing\Sales"
If MemberOf(ObjGroupDict, "Proposal Group") Then
RCKNetwork.MapNetworkDrive "T:", strDFS &
"Departments\Finance\Proposals"
If MemberOf(ObjGroupDict, "Development Group") Then
RCKNetwork.MapNetworkDrive "U:", strDFS &
"Departments\Research\Develop"
' Map L: Drive
If MapLDrive = TRUE Then RCKNetwork.MapNetworkDrive "L:", strLDrv
Function MemberOf(ObjDict, strKey)
' Given a Dictionary object containing groups to which the user
' is a member of and a group name, then returns True if the group
' is in the Dictionary else return False.
'
' Inputs:
' strDict - Input, Name of a Dictionary object
' strKey - Input, Value being searched for in
' the Dictionary object
' Sample Usage:
'
' If MemberOf(ObjGroupDict, "DOMAIN ADMINS") Then
' wscript.echo "Is a member of Domain Admins."
' End If
'
'
MemberOf = CBool(ObjGroupDict.Exists(strKey))
End Function
Function CreateMemberOfObject(strUserDomain, strUserName)
' Given a domain name and username, returns a Dictionary
' object of groups to which the user is a member of.
'
' Inputs:
'
' strDomain - Input, NT Domain name
' strUserName - Input, NT username
'
Dim objUser, objGroup
Set CreateMemberOfObject = CreateObject("Scripting.Dictionary")
CreateMemberOfObject.CompareMode = vbTextCompare
Set objUser = GetObject("WinNT://" _
& strDomain & "/" _
& strUserName & ",user")
For Each objGroup In objUser.Groups
CreateMemberOfObject.Add objGroup.Name, "-"
Next
Set objUser = Nothing
I have verified that both authenticated users group and domain users
group the default permissions to include the read and apply policy
permission. Is there something I'm overlooking?
Please assit
thank you
Jerrald Noland
jnoland767@hotmail.com
End Function Tag: vb script to change pagefile to system managed Tag: 191174
Receiving error when adding IP printer.
A little background: I support about 20 retail locations that all are
set up with IP printing. One of the biggest pains in providing support
is having to go into each machine and manually enter a port and load
the printer drivers.
So, I decided I wanted to play around with a script to automate the
process.
I found the script online to do this.. or so I thought. The script
works great when I am adding a printer that has the necessary drivers
loaded to it... it's only when I try to tell it to load a driver, that
it fails with:
Error: Generic Failure
Code: 80041001
Source: SWbemObjectEx
The error points to a line in the script that actually adds the
printer... but I have a feeling the driver is not loading properly.
Here's part of the code:
---------------------------------------------------------------------------------------------------------------------------------
'*** INSTALL DRIVER
****************************************************
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege",
True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = driver_name
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
'objDriverPath = dll_path
objInfname = inf_path
intResult = objDriver.AddPrinterDriver(objDriver)
wscript.echo intResult
'*** ADD PRINTER *****************************************
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = driver_name
objPrinter.PortName = "IP_" & port_ip
objPrinter.DeviceID = printer_name
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.Put_
If print_default = "Y" then
objPrinter.SetDefaultPrinter()
End if
--------------------------------------------------------------------------------------------------------------------------------------
I've checked the paths to the .inf and .dll a hundred times. I've
searche on the internet and found several people with the same problem
but no real solutions.
Anyone have any ideas? Tag: vb script to change pagefile to system managed Tag: 191173
Accessing Crypto API via vbscript
Hi,
I am trying to find out a way of accessing Windows Crypto API within
vbscript so that I can compute a hash of a string and encrypt\decrypt some
information. I am hoping to accomplish this without using any wrappers
around Crypto API, so I don't want to use third party dll's or controls. Is
this possible?
Thank you Tag: vb script to change pagefile to system managed Tag: 191171
invoke a VBscript from within a word macro
hi, all
I'm trying to invoke a vbscipt from within a word macro.
I'm using
RetVal = Shell("C:\docs\binfile.vbs", 0)
however, this gives me an error:
" Run-time error '5':
Invalid procedure call or argument"
Does anyone know how to do this.. if I replace the path of vbscript
with an EXE file, it works fine.. and if I call the vbscript frm the
command line. it also works fine. thanks.. Tag: vb script to change pagefile to system managed Tag: 191167
SQL commands from VBScript?
Hi all,
can I connect to a database (e. g. Oracle) and pass SQL commands from
my VBScript code? Where can I find information about this issue?
Jens Tag: vb script to change pagefile to system managed Tag: 191164
Hardware RAID and individual disk drives sizes and status
Does anyone have/know of a VB script that can tell me the size and
number of drives that make up a RAID configuration using VBS?
-TIA- Tag: vb script to change pagefile to system managed Tag: 191163
Password Expiration
What is the AD property to deteremine the date a user's password is going to
expire?
Bart Perrier Tag: vb script to change pagefile to system managed Tag: 191161
Desktop icons
Hi,
I am looking at desktop icons and want to delete only icons that meet a
criteria of having a specific value in the "Start in" property. Currently,
I'm only looking to display those names that meet this requirement, but I've
come across a roadblock. I can't even figure out how to extract that
property or even if it's possible. I have the following code:
Const ALL_USERS_DESKTOP = &H19&
Set objApp = CreateObject("Shell.Application")
Set objShell = Wscript.CreateObject("WScript.Shell")
Set objFolder = objApp.Namespace(ALL_USERS_DESKTOP)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path
Set colItems = objFolder.Items
For Each objItem In colItems
sResult = sResult & " " & objItem.TargetPath & vbCrLf
Next
wScript.Echo sResult
Does anyone have a suggestion?
Thanks in Advance,
JeffH Tag: vb script to change pagefile to system managed Tag: 191159
E-mail script doesn't work more!
Hello all.
I had a script for long time that send a e-mail with an attachment. Here is:
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "local_server@local.com"
objEmail.To = "target_email@local.com"
objEmail.Subject = "Notification of May"
objEmail.Textbody = "Hi all, here's the monthly notification. "
objEmail.AddAttachment "\\pc0012\share1\notif.xls"
objEmail.Send
It worked fine... but I instaled de SP4 for SQL server and since that
installation the script doesn't work.
I already tried to put my firewall Off and I tried also without attachments
but nothing.
Maybe could you help me please?
henpat.
Thanks Tag: vb script to change pagefile to system managed Tag: 191158
Asp and script
Iv gt an asp page that has two buttons on it.
one button uses a form and the other uses scrpit to go to the next
page.
I need both buttons to submit data.
Iv usesd this on page1:
public varform
varform =3D ""
'"Activity_Rpt_Inv4.asp?klient=3Dresponse.write(request.querystring("klient=
")=AD)&adviseur=3Dresponse.write(
session("Pers_ID"))&ActId=3Dresponse.write(request.querystring("ActId"))"
<script type=3D"text/vbscript" language=3D"VBScript" event=3D"onClick"
for=3D"btnPrint">
InvDisp.action =3D
"Activity_Rpt_Inv5.asp?klient=3D<%=3D
request.querystring("klient") %>&adviseur=3D<%=3D session("Pers_ID")
%>&ActId=3D<%=3D request.querystring("ActId") %>"
InvDisp.submit
</script>
<form action=3D<%=3D varform %> method=3D"post" name=3D"InvDisp">
But they nt working. The code used to go to a page using the scrpit
works in the sense that it goes to the pasge,bt the data is nt
transferred.=20
please help Tag: vb script to change pagefile to system managed Tag: 191153
Stripping out nested quotes
I have a script that processes a csv file using the filesystemobject
method - at the moment, I'm reading in a csv, doing a replace function
on certain specific characters, then writing the result back to another
file.
However, I have a problem in that the csv uses quotes as text
delimiters, and some fields contain nested quotes - which I need to
strip out.
The nested quotes are not necessarily at the beginning and end of the
strings (such as ""NAME"") - in theory, they could be anywhere (e.g.
"NA"ME").
Obviously each field is separated by a comma, and starts and ends with
a quote, which is all as expected - I just need to strip out any other
quotes within the fields.
Does anyone have a script that would do this? Tag: vb script to change pagefile to system managed Tag: 191151
Clear the ReadOnly flag.
Hi.
I'm a new VBscripter, so probably this my question may be a little stupid.
I'm trying to create a simple 'batch' file to copy files from CD to
hard-disk. The problem is that the files on hard disk will have the ReadOnly
flag set.
I tryed the following code (recursive to run on subfolders too), but it
don't work. I call it with WSCRIPT.
Can someone help me ?
Thank You very much.
Alberto.
' Main call
call VBS_ClearReadOnlyFlag ("C:\FOLDER_EXAMPLE")
' Subroutine
Sub VBS_ClearReadOnlyFlag (szFolder)
Dim oFolder, oSubFolder, oFiles, f, f1
' Check if folder exist
If (oFS.FolderExists (szFolder) = 0) Then
Exit Sub
End If
Set oFolder = oFS.GetFolder (szFolder)
Set oSubFolder = oFolder.SubFolders
For Each f in oSubFolder
call VBS_ClearReadOnlyFlag (f.Path)
Next
Set oFiles = oFolder.Files
For Each f in oFiles
Set f1 = oFS.GetFile (f.Path)
f1.Attributes = f1.Attributes - ReadOnly
Next
End Sub Tag: vb script to change pagefile to system managed Tag: 191150
Access is denied error running vb exe from vbscript after SP2 upgr
Hi,
Since upgrading to XP SP2 I'm getting an "access is denied" popup error
message with the following vbscript code in IE 6:
...
xxprt = "c:\inetpub\wwwroot\abc\prtprog.EXE"
window.open xxprt
....
This worked prior to the SP2 upgrade and the exe works when run from Windows
Explorer it just fails via the browser. When I change the path to :
xxprt = "http://localhost/abc/prtprog.EXE"
it works except it then gets a "File not found 53" vb error for a file that
is in the directory.
I've had a look at the security updates for SP2 and tried a few things (eg.
adding IUSR_ account to all directories and exe,inserting Mark of Web
comment) but to no avail.
Thanks in Advance,
Michael Tag: vb script to change pagefile to system managed Tag: 191149
script for remote desktop
I need help with a vbscript to be able to query a fixed list of
computers on the network if there are any user logged on thru remote
desktop connections and return a result if the computers are logged on
or not. As the file and print sharing had been disabled on those
computers, so those scripts that I got (using Win32_ComputerSystem etc)
are not able to work. Scripts that ping to those computers also doesn't
give accurate results, as I'll still get connected results even if no
user is log on but the PC is power up.
is there any way to do up a vbscript to query like event logs etc for
checking if there's any user logged on?
Thanks! Tag: vb script to change pagefile to system managed Tag: 191142
WMI & Shutdown
Hi,
Running a short vbs script that uses the win32shutdown method(?) of
the winmgmts win32_operatingsystem object produces the following error:
Error: Privilege not held.
Code: 80041062
Source SWbemObject
Can the privilege be enabled?
The operating system is Win2K, SP 4 with the roll up fixes.
--
Bill Tag: vb script to change pagefile to system managed Tag: 191131
Retrieve Parameter from location bar
Hi Everybody
I have an Access database that passes a Parameter to a web page
something like this.
http://localhost/index.htm?paramName=1234-54321
I want to be able to retrieve the parameter (In this example
1234-54321) and pass it to a text box on a form. Something like this.
<form name="form1" id="form1" method="post" action="">
<input type="text" name="txtinput" value= "Param" />
</form>
Any help gratefully received Tag: vb script to change pagefile to system managed Tag: 191126
CreateObject fails in .VBS script file but works in .ASP file !
Hi,
I can't instantiate an ActiveX component in a .VBS script file with
this code :
set myObject = createObject("ChilkatMail2.ChilkatMailMan2")
This component is used to send mails and it's really an "ActiveX
component".
I receive the following error message : "Could not create object named
ChilkatMail2.ChilkatMailMan2"
Note that if I run this .vbs with Cscript or WScript I receive the same
error message.
I also tried to create object with this code :
set myObject = Wscript.createObject("ChilkatMail2.ChilkatMailMan2")
... the result is the same.
But now, if I try exactly the same code in an .ASP page it WORKS !!!!!
The only difference is that I use Server.CreateObject (because it's
ASP).
This means that :
- the component is correctly registered (I checked all the entry points
with COM explorer)
- all the dependencies are present on the system (I think so...)
I'm logged on as Administrator, my system is Windows Server 2003 SP1
(x64)
I spend two days searching the web and I didn't find the solution,
could you please help me ?
Thanks a lot !!!
Regards
Thierry Tag: vb script to change pagefile to system managed Tag: 191123
obtain external data
Hi everyone:
is there a way to obtain an external data from a file, let's say Microsoft
excel , within a vbscript file ??.
I'm asking because I wanna use vbscript to automatize certain function in a
R/3 software (SAP), and i have a list of parameters i need to load , but
they're saved in an excel file, the file is hughe so i cannot ( don't want
to ) manually parse into the script (could be done using inputbox).
This is seudo diagram of wath i'm trying to do.
retrieve PARAM(1) ----->PARAM(n) from excel file--->[this i down't know]
perform a format conversion or another kind of
operation -->'//this i can do well
paste value loaded from excel into a textbox within the
application.->'//also this
select some checkboxes and radio buttons'// cool about this
programatically click some buttons [ eg: save and
close ]->'// this is not a problem : -)
i know it is with some createobject() , but i haven't worked before with
this so any help would be hot...
thank's in advantage. Tag: vb script to change pagefile to system managed Tag: 191117
Run office 2003 SP1 with VBscript
Hi,
I have just started to get involved in scripting, I am currently
working on a script to copy Office 2003 SP1 to a local computer from a
server and run it silently. Here is what I have done so far, but it
does not seem to be running the install. Can anyone give me a hand, it
would be greatly appreciated.
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile
"\\SERVERNAME\support$\DSS\Temp\Office2003SP1-kb842532-fullfile-enu.exe"
, "C:\pkgdirs\", OverwriteExisting
Const ALL_USERS = True
Set objService = GetObject("winmgmts:")
Set objSoftware = objService.Get("Win32_Product")
errReturn =
objSoftware.Install("c:\pkgdirs\Office2003SP1-kb842532-fullfile-enu.exe
/q", , ALL_USERS)
Thanks
Netace Tag: vb script to change pagefile to system managed Tag: 191101
Set Internet Explorer as the default browser using VBScript
I am in the process of automating the removal of an email client that is
integrated with Internet Explorer. After I remove the client, the first time
the users runs Internet Explorer it displays a message saying that it is not
the default browser and would you like to make it the default browser. I
would like to set it as the default browser in the VBScript that removes the
email client. Is there a way to do this?
Thanks Tag: vb script to change pagefile to system managed Tag: 191100
I found plenty of scripts to change page file sizes but none to change to
system managed.