|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Scripting Newbie needs help
retrieve_TS_Profile_ISD.vbs). U:\MyFiles\MISC\AD_Scripts\VB_Examples\retrieve_TS_Profile_ISD.vbs(10, 5) Micros oft VBScript compilation error: Expected statement Code is: Const ADS_SECURE_AUTHENTICATION = 1 Const ADS_USE_ENCRYPTION = 2 strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" strUser = "domain\account" strPassword = "xxxxxxxxxxx" Set DSO = GetObject("LDAP:") Set usr = DSO.OpenDSObject_ (strPath, strUser, strPassword, _ ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) For Each usr in strPath Wscript.echo usr.TerminalServicesProfilePath Wscript.echo usr.TerminalServicesHomeDirectory Wscript.echo usr.TerminalServicesHomeDrive Wscript.echo usr.AllowLogon Wscript.Echo Next Pat Hall wrote:
Show quote >I get this error when I run my script form the command line csrcipt You need a space between OpenDSObject and the underscore line continuation > retrieve_TS_Profile_ISD.vbs). > > U:\MyFiles\MISC\AD_Scripts\VB_Examples\retrieve_TS_Profile_ISD.vbs(10, 5) > Micros > oft VBScript compilation error: Expected statement > > Code is: > > Const ADS_SECURE_AUTHENTICATION = 1 > Const ADS_USE_ENCRYPTION = 2 > > strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" > strUser = "domain\account" > strPassword = "xxxxxxxxxxx" > > Set DSO = GetObject("LDAP:") > Set usr = DSO.OpenDSObject_ > (strPath, strUser, strPassword, _ > ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) character. Otherwise, OpenDSObject_ is one token to the interpreter. Show quote > > For Each usr in strPath > Wscript.echo usr.TerminalServicesProfilePath > Wscript.echo usr.TerminalServicesHomeDirectory > Wscript.echo usr.TerminalServicesHomeDrive > Wscript.echo usr.AllowLogon > Wscript.Echo > Next
Show quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in Also, you are enumerating a string instead of the OU object at the end. And, message news:O6tqR6CaHHA.4692@TK2MSFTNGP04.phx.gbl... > Pat Hall wrote: > >>I get this error when I run my script form the command line csrcipt >> retrieve_TS_Profile_ISD.vbs). >> >> U:\MyFiles\MISC\AD_Scripts\VB_Examples\retrieve_TS_Profile_ISD.vbs(10, 5) >> Micros >> oft VBScript compilation error: Expected statement >> >> Code is: >> >> Const ADS_SECURE_AUTHENTICATION = 1 >> Const ADS_USE_ENCRYPTION = 2 >> >> strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" >> strUser = "domain\account" >> strPassword = "xxxxxxxxxxx" >> >> Set DSO = GetObject("LDAP:") >> Set usr = DSO.OpenDSObject_ >> (strPath, strUser, strPassword, _ >> ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) > > > You need a space between OpenDSObject and the underscore line continuation > character. Otherwise, OpenDSObject_ is one token to the interpreter. > >> >> For Each usr in strPath >> Wscript.echo usr.TerminalServicesProfilePath >> Wscript.echo usr.TerminalServicesHomeDirectory >> Wscript.echo usr.TerminalServicesHomeDrive >> Wscript.echo usr.AllowLogon >> Wscript.Echo >> Next > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > you are assuming that all of the child objects are users. I would suggest: Set DSO = GetObject("LDAP:") Set objOU = DSO.OpenDSObject _ (strPath, strUser, strPassword, _ ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) objOU.Filter = Array("user") For Each usr in objOU Wscript.echo usr.TerminalServicesProfilePath Wscript.echo usr.TerminalServicesHomeDirectory Wscript.echo usr.TerminalServicesHomeDrive Wscript.echo usr.AllowLogon Wscript.Echo Next Thanks. Made the changes you suggested. Now I'm getting the error "The
server is not operational". I googled the error and checked the spelling of everthing. Any chance I need to add some more code so the script knows exactly where to look? The server is operational. Script is now: Const ADS_SECURE_AUTHENTICATION = 1 Const ADS_USE_ENCRYPTION = 2 'On Error Resume Next strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" strUser = "domain\account" strPassword = "xxxxxxxxx" Set DSO = GetObject("LDAP:") Set objOU = DSO.OpenDSObject _ (strPath, strUser, strPassword, _ ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) objOU.Filter = Array("user") For Each usr in objOU Wscript.echo usr.TerminalServicesProfilePath Wscript.echo usr.TerminalServicesHomeDirectory Wscript.echo usr.TerminalServicesHomeDrive Wscript.echo usr.AllowLogon Wscript.Echo Next Show quote "Richard Mueller [MVP]" wrote: > > "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in > message news:O6tqR6CaHHA.4692@TK2MSFTNGP04.phx.gbl... > > Pat Hall wrote: > > > >>I get this error when I run my script form the command line csrcipt > >> retrieve_TS_Profile_ISD.vbs). > >> > >> U:\MyFiles\MISC\AD_Scripts\VB_Examples\retrieve_TS_Profile_ISD.vbs(10, 5) > >> Micros > >> oft VBScript compilation error: Expected statement > >> > >> Code is: > >> > >> Const ADS_SECURE_AUTHENTICATION = 1 > >> Const ADS_USE_ENCRYPTION = 2 > >> > >> strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" > >> strUser = "domain\account" > >> strPassword = "xxxxxxxxxxx" > >> > >> Set DSO = GetObject("LDAP:") > >> Set usr = DSO.OpenDSObject_ > >> (strPath, strUser, strPassword, _ > >> ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) > > > > > > You need a space between OpenDSObject and the underscore line continuation > > character. Otherwise, OpenDSObject_ is one token to the interpreter. > > > >> > >> For Each usr in strPath > >> Wscript.echo usr.TerminalServicesProfilePath > >> Wscript.echo usr.TerminalServicesHomeDirectory > >> Wscript.echo usr.TerminalServicesHomeDrive > >> Wscript.echo usr.AllowLogon > >> Wscript.Echo > >> Next > > > > -- > > Richard Mueller > > Microsoft MVP Scripting and ADSI > > Hilltop Lab - http://www.rlmueller.net > > -- > > > > > > Also, you are enumerating a string instead of the OU object at the end. And, > you are assuming that all of the child objects are users. I would suggest: > > Set DSO = GetObject("LDAP:") > Set objOU = DSO.OpenDSObject _ > (strPath, strUser, strPassword, _ > ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) > > objOU.Filter = Array("user") > > For Each usr in objOU > Wscript.echo usr.TerminalServicesProfilePath > Wscript.echo usr.TerminalServicesHomeDirectory > Wscript.echo usr.TerminalServicesHomeDrive > Wscript.echo usr.AllowLogon > Wscript.Echo > Next > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > Pat wrote:
Show quote > Thanks. Made the changes you suggested. Now I'm getting the error "The The problem is ADS_USE_ENCRYPTION. Remove this and it will probably work. > server is not operational". I googled the error and checked the spelling > of > everthing. Any chance I need to add some more code so the script knows > exactly where to look? The server is operational. > > Script is now: > > Const ADS_SECURE_AUTHENTICATION = 1 > Const ADS_USE_ENCRYPTION = 2 > > 'On Error Resume Next > > strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" > strUser = "domain\account" > strPassword = "xxxxxxxxx" > > Set DSO = GetObject("LDAP:") > Set objOU = DSO.OpenDSObject _ > (strPath, strUser, strPassword, _ > ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) > > objOU.Filter = Array("user") > > For Each usr in objOU > Wscript.echo usr.TerminalServicesProfilePath > Wscript.echo usr.TerminalServicesHomeDirectory > Wscript.echo usr.TerminalServicesHomeDrive > Wscript.echo usr.AllowLogon > Wscript.Echo > Next > I'm investigating when you can use it.
Show quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in Ah, ADS_USE_ENCRYPTION is the same as ADS_USE_SSL. They both have the value message news:%23DYp%23tLaHHA.4940@TK2MSFTNGP05.phx.gbl... > Pat wrote: > >> Thanks. Made the changes you suggested. Now I'm getting the error "The >> server is not operational". I googled the error and checked the spelling >> of >> everthing. Any chance I need to add some more code so the script knows >> exactly where to look? The server is operational. >> >> Script is now: >> >> Const ADS_SECURE_AUTHENTICATION = 1 >> Const ADS_USE_ENCRYPTION = 2 >> >> 'On Error Resume Next >> >> strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" >> strUser = "domain\account" >> strPassword = "xxxxxxxxx" >> >> Set DSO = GetObject("LDAP:") >> Set objOU = DSO.OpenDSObject _ >> (strPath, strUser, strPassword, _ >> ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) >> >> objOU.Filter = Array("user") >> >> For Each usr in objOU >> Wscript.echo usr.TerminalServicesProfilePath >> Wscript.echo usr.TerminalServicesHomeDirectory >> Wscript.echo usr.TerminalServicesHomeDrive >> Wscript.echo usr.AllowLogon >> Wscript.Echo >> Next >> > > The problem is ADS_USE_ENCRYPTION. Remove this and it will probably work. > I'm investigating when you can use it. > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > 2. AD requires that the Certificate Server be installed to support SSL. Thanks. That fixed the problem. Thanks for all your help.
Show quote "Richard Mueller [MVP]" wrote: > > "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in > message news:%23DYp%23tLaHHA.4940@TK2MSFTNGP05.phx.gbl... > > Pat wrote: > > > >> Thanks. Made the changes you suggested. Now I'm getting the error "The > >> server is not operational". I googled the error and checked the spelling > >> of > >> everthing. Any chance I need to add some more code so the script knows > >> exactly where to look? The server is operational. > >> > >> Script is now: > >> > >> Const ADS_SECURE_AUTHENTICATION = 1 > >> Const ADS_USE_ENCRYPTION = 2 > >> > >> 'On Error Resume Next > >> > >> strPath = "LDAP://OU=ISD,OU=GSO,DC=gso,DC=gilbarco,DC=com" > >> strUser = "domain\account" > >> strPassword = "xxxxxxxxx" > >> > >> Set DSO = GetObject("LDAP:") > >> Set objOU = DSO.OpenDSObject _ > >> (strPath, strUser, strPassword, _ > >> ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION) > >> > >> objOU.Filter = Array("user") > >> > >> For Each usr in objOU > >> Wscript.echo usr.TerminalServicesProfilePath > >> Wscript.echo usr.TerminalServicesHomeDirectory > >> Wscript.echo usr.TerminalServicesHomeDrive > >> Wscript.echo usr.AllowLogon > >> Wscript.Echo > >> Next > >> > > > > The problem is ADS_USE_ENCRYPTION. Remove this and it will probably work. > > I'm investigating when you can use it. > > > > -- > > Richard Mueller > > Microsoft MVP Scripting and ADSI > > Hilltop Lab - http://www.rlmueller.net > > -- > > > > > > Ah, ADS_USE_ENCRYPTION is the same as ADS_USE_SSL. They both have the value > 2. AD requires that the Certificate Server be installed to support SSL. > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > |
|||||||||||||||||||||||