From: psebas on 12 Apr 2010 09:06 in the domain I have thousands of users, each with its logonscript, according as it will have a different user: eg "user1" has the logon script: "user.vbs normal" and "user2" has "privileged user.vbs" (both with spaces) [image: http://img521.imageshack.us/i/borame.jpg/][image: http://img521.imageshack.us/img521/8361/borame.jpg] If clients are Windows XP these scripts are executed, but if they are Windows Vista or Windows 7, not work. It appears that the cause are the quotes, but are necessary because the file name contains spaces. It is necessary that the filenames of the scripts contain blank spaces Any idea how to fix? -- psebas
From: francois on 12 Apr 2010 11:14 psebas wrote : > It is necessary that the filenames of the scripts contain blank spaces > Any idea how to fix? To my mind, you must changed the name of the script for all users : "normal user.vbs" ---> normalUser.vbs "privileged user.vbs" ---> privilegedUser.vbs Quote and space are not a good idea (to my mind). You can used a vbs script like this (not tested) : '########################################################### ldap_adress = "LDAP://OU=MyUsers,DC=mydomain,DC=local" '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Set objConnetion = Wscript.createObject("ADODB.Connection") Call objConnetion.open ("Provider=ADsDSOObject;") Set objCommand = Wscript.createObject("ADODB.Command") objCommand.activeConnection = objConnetion objCommand.commandText = _ "<" & ldap_adress & ">;" & _ "(ObjectCategory=user);" & _ "ADsPath,scriptPath;" & _ "subtree" Set objRecord = objCommand.Execute '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Do Until objRecord.EOF scriptPath = objRecord.Fields("scriptPath").Value If InStr(scriptPath, "privileged") Then Set objUser = getObject(objRecord.fields("ADsPath")) Call objUser.put("scriptPath", "privilegedUser.vbs") Call objUser.setInfo() End If If InStr(scriptPath, "normal") Then Set objUser = getObject(objRecord.fields("ADsPath")) Call objUser.put("scriptPath", "normalUser.vbs") Call objUser.setInfo() End If Call objRecord.moveNext() Loop Call objConnetion.close() '########################################################### -- Fran�ois Lafont
From: Al Dunbar on 13 Apr 2010 23:10 "francois" <francois(a)NoSpam.fr> wrote in message news:u7ehZLl2KHA.4016(a)TK2MSFTNGP05.phx.gbl... > psebas wrote : > >> It is necessary that the filenames of the scripts contain blank spaces >> Any idea how to fix? > > To my mind, you must changed the name of the script for all users : > > "normal user.vbs" ---> normalUser.vbs > "privileged user.vbs" ---> privilegedUser.vbs This is probably sound advice, however, it means having to change the corresponding AD attribute for all of your accounts - a good job for another script. But before doing that, I would suggest you do a test with a test account. If giving the logon script a name without whitespace (and/or without quotes) does not fix the problem, that could mean that other issues are at play. One thing comes to mind: vista and w7 try to protect the user from rogue code through a variety of techniques. It could be that your scripts need to be signed or somehow identified as safe. I'd even try the existing names but without quotes, just to see if that works. If so, it would have to also work on XP clients, or you'd have another problem. /Al > Quote and space are not a good idea (to my mind). You can used a vbs > script like this (not tested) : > > > '########################################################### > ldap_adress = "LDAP://OU=MyUsers,DC=mydomain,DC=local" > > '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > Set objConnetion = Wscript.createObject("ADODB.Connection") > Call objConnetion.open ("Provider=ADsDSOObject;") > Set objCommand = Wscript.createObject("ADODB.Command") > objCommand.activeConnection = objConnetion > objCommand.commandText = _ > "<" & ldap_adress & ">;" & _ > "(ObjectCategory=user);" & _ > "ADsPath,scriptPath;" & _ > "subtree" > Set objRecord = objCommand.Execute > '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > Do Until objRecord.EOF > > scriptPath = objRecord.Fields("scriptPath").Value > > If InStr(scriptPath, "privileged") Then > Set objUser = getObject(objRecord.fields("ADsPath")) > Call objUser.put("scriptPath", "privilegedUser.vbs") > Call objUser.setInfo() > End If > > > If InStr(scriptPath, "normal") Then > Set objUser = getObject(objRecord.fields("ADsPath")) > Call objUser.put("scriptPath", "normalUser.vbs") > Call objUser.setInfo() > End If > > Call objRecord.moveNext() > > Loop > > Call objConnetion.close() > '########################################################### > > > > -- > Fran�ois Lafont
|
Pages: 1 Prev: Autorun a .vbs file on CD-Rom Next: working with exceptions |