| Home | Register | Members | Search | Windows Vista Tips | File Database | Links |
![]() |
| Thread Tools | Display Modes |
|
|
|
| |
|
Richard Mueller [MVP]
Guest
Posts: n/a
|
"Jeremy" <trombone79atgmail.com> wrote in message news:... >I have been doing this for years in XP and Server 2003, but recently I have >been installing Vista x64 Edition for some specific needs. This code is >part of a workstation startup script that pulls the description from AD and >makes it the local description on the computer. This does not work in >Vista x64 or Server 2008 x64 and I have found no explanation on the >Internet as of yet. I have not tested in x86 installs of the same OS. >Yes, I am running it as administrator while testing, if I do not, I receive >Access Denied. > > > sComputer = "." > Set Obj = GetObject("winmgmts:\\" & sComputer & > "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) > For Each x In Obj > x.Description = "This is the computer description." > x.Put_ > Next > > > The object is being created just fine. I can use other methods on the > object successfully like GetText_ . I have found no documentation that > says Put_ shouldn't work. > Any help would be appreciated. This one is driving me crazy. > > When running, I receive the following error: > --------------------------- > Windows Script Host > --------------------------- > Script: C:\Users\username\Desktop\test.vbs > Line: 6 > Char: 4 > Error: Value out of range > Code: 8004102B > Source: SWbemObjectEx > > --------------------------- > OK > --------------------------- > > Thanks Does it help to specify impersonationLevel and authenticationLevel when you connect with WMI? For example: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ & strComputer & "\root\cimv2") Also, when you say you run the script as Administrator, I assume you either right click the script and select "Run as administrator", or you run a command prompt by right clicking cmd.exe and selecting "Run as administrator". Being authenticated to the machine with administrator credentials no longer will work. Finally, which is line 6? -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
|
|
|
|
|||
|
|||
|
Jeremy
Guest
Posts: n/a
|
I run from a command prompt that I righ-click to run as administrator.
There is no option in the context menu on a .vbs file. Setting the impersonationLevel=impersonate yields exactle the same result. I have tried with and without it. The error Line (line 6 in my error) is x.Put_ . Thanks for your reply. Sorry to everyone about the double post. "Richard Mueller [MVP]" <rlmueller-> wrote in message news:... > > "Jeremy" <trombone79atgmail.com> wrote in message > news:... >>I have been doing this for years in XP and Server 2003, but recently I >>have been installing Vista x64 Edition for some specific needs. This code >>is part of a workstation startup script that pulls the description from AD >>and makes it the local description on the computer. This does not work in >>Vista x64 or Server 2008 x64 and I have found no explanation on the >>Internet as of yet. I have not tested in x86 installs of the same OS. >>Yes, I am running it as administrator while testing, if I do not, I >>receive Access Denied. >> >> >> sComputer = "." >> Set Obj = GetObject("winmgmts:\\" & sComputer & >> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >> For Each x In Obj >> x.Description = "This is the computer description." >> x.Put_ >> Next >> >> >> The object is being created just fine. I can use other methods on the >> object successfully like GetText_ . I have found no documentation that >> says Put_ shouldn't work. >> Any help would be appreciated. This one is driving me crazy. >> >> When running, I receive the following error: >> --------------------------- >> Windows Script Host >> --------------------------- >> Script: C:\Users\username\Desktop\test.vbs >> Line: 6 >> Char: 4 >> Error: Value out of range >> Code: 8004102B >> Source: SWbemObjectEx >> >> --------------------------- >> OK >> --------------------------- >> >> Thanks > > > Does it help to specify impersonationLevel and authenticationLevel when > you connect with WMI? For example: > > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ > & strComputer & "\root\cimv2") > > > Also, when you say you run the script as Administrator, I assume you > either right click the script and select "Run as administrator", or you > run a command prompt by right clicking cmd.exe and selecting "Run as > administrator". Being authenticated to the machine with administrator > credentials no longer will work. Finally, which is line 6? > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > |
|
|
|
|
|||
|
|||
|
Alex K. Angelopoulos
Guest
Posts: n/a
|
I've tried the demo code and have no trouble at all with it on Vista
Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server x64. Did you try the _modified_ version on the computer, the one that simply sets the description as you showed? I'm asking because I suspect the error message could be correct with AD data in some circumstances. Depending on what you're pulling from where in AD, the value you return may not be a standard text string. If you find a generic description can be set successfully, I suggest you next look at the data you're returning from AD to use as the description. I would check two things: the typename for the returned value, and then - if it appears to be a single string - I suggest escaping the data and displaying it, to check for possible odd characters. WScript.Echo TypeName(AdDescription) WScript.Echo Escape(AdDescription) "Jeremy" <trombone79atgmail.com> wrote in message news:... > I run from a command prompt that I righ-click to run as administrator. > There is no option in the context menu on a .vbs file. > > Setting the impersonationLevel=impersonate yields exactle the same result. > I have tried with and without it. > > The error Line (line 6 in my error) is x.Put_ . > > Thanks for your reply. > > > Sorry to everyone about the double post. > > "Richard Mueller [MVP]" <rlmueller-> wrote in > message news:... >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:... >>>I have been doing this for years in XP and Server 2003, but recently I >>>have been installing Vista x64 Edition for some specific needs. This >>>code is part of a workstation startup script that pulls the description >>>from AD and makes it the local description on the computer. This does >>>not work in Vista x64 or Server 2008 x64 and I have found no explanation >>>on the Internet as of yet. I have not tested in x86 installs of the same >>>OS. Yes, I am running it as administrator while testing, if I do not, I >>>receive Access Denied. >>> >>> >>> sComputer = "." >>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>> For Each x In Obj >>> x.Description = "This is the computer description." >>> x.Put_ >>> Next >>> >>> >>> The object is being created just fine. I can use other methods on the >>> object successfully like GetText_ . I have found no documentation that >>> says Put_ shouldn't work. >>> Any help would be appreciated. This one is driving me crazy. >>> >>> When running, I receive the following error: >>> --------------------------- >>> Windows Script Host >>> --------------------------- >>> Script: C:\Users\username\Desktop\test.vbs >>> Line: 6 >>> Char: 4 >>> Error: Value out of range >>> Code: 8004102B >>> Source: SWbemObjectEx >>> >>> --------------------------- >>> OK >>> --------------------------- >>> >>> Thanks >> >> >> Does it help to specify impersonationLevel and authenticationLevel when >> you connect with WMI? For example: >> >> strComputer = "." >> Set objWMIService = GetObject("winmgmts:" _ >> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >> & strComputer & "\root\cimv2") >> >> >> Also, when you say you run the script as Administrator, I assume you >> either right click the script and select "Run as administrator", or you >> run a command prompt by right clicking cmd.exe and selecting "Run as >> administrator". Being authenticated to the machine with administrator >> credentials no longer will work. Finally, which is line 6? >> >> -- >> Richard Mueller >> MVP Directory Services >> Hilltop Lab - http://www.rlmueller.net >> -- >> >> > > |
|
|
|
|
|||
|
|||
|
Richard Mueller [MVP]
Guest
Posts: n/a
|
The description attribute in AD is multi-valued, even though there is never
more than one value. Depending on how you retrieve the value, you could get an array. For example, ADO either returns a Null if there is no value, or an array of one string value. TypeName will return "String()" in the later case. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OUx%23$... > I've tried the demo code and have no trouble at all with it on Vista > Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server > x64. > > Did you try the _modified_ version on the computer, the one that simply > sets the description as you showed? I'm asking because I suspect the error > message could be correct with AD data in some circumstances. Depending on > what you're pulling from where in AD, the value you return may not be a > standard text string. > > If you find a generic description can be set successfully, I suggest you > next look at the data you're returning from AD to use as the description. > I would check two things: the typename for the returned value, and then - > if it appears to be a single string - I suggest escaping the data and > displaying it, to check for possible odd characters. > > WScript.Echo TypeName(AdDescription) > WScript.Echo Escape(AdDescription) > > "Jeremy" <trombone79atgmail.com> wrote in message > news:... >> I run from a command prompt that I righ-click to run as administrator. >> There is no option in the context menu on a .vbs file. >> >> Setting the impersonationLevel=impersonate yields exactle the same >> result. I have tried with and without it. >> >> The error Line (line 6 in my error) is x.Put_ . >> >> Thanks for your reply. >> >> >> Sorry to everyone about the double post. >> >> "Richard Mueller [MVP]" <rlmueller-> wrote in >> message news:... >>> >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:... >>>>I have been doing this for years in XP and Server 2003, but recently I >>>>have been installing Vista x64 Edition for some specific needs. This >>>>code is part of a workstation startup script that pulls the description >>>>from AD and makes it the local description on the computer. This does >>>>not work in Vista x64 or Server 2008 x64 and I have found no explanation >>>>on the Internet as of yet. I have not tested in x86 installs of the >>>>same OS. Yes, I am running it as administrator while testing, if I do >>>>not, I receive Access Denied. >>>> >>>> >>>> sComputer = "." >>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>> For Each x In Obj >>>> x.Description = "This is the computer description." >>>> x.Put_ >>>> Next >>>> >>>> >>>> The object is being created just fine. I can use other methods on the >>>> object successfully like GetText_ . I have found no documentation that >>>> says Put_ shouldn't work. >>>> Any help would be appreciated. This one is driving me crazy. >>>> >>>> When running, I receive the following error: >>>> --------------------------- >>>> Windows Script Host >>>> --------------------------- >>>> Script: C:\Users\username\Desktop\test.vbs >>>> Line: 6 >>>> Char: 4 >>>> Error: Value out of range >>>> Code: 8004102B >>>> Source: SWbemObjectEx >>>> >>>> --------------------------- >>>> OK >>>> --------------------------- >>>> >>>> Thanks >>> >>> >>> Does it help to specify impersonationLevel and authenticationLevel when >>> you connect with WMI? For example: >>> >>> strComputer = "." >>> Set objWMIService = GetObject("winmgmts:" _ >>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>> & strComputer & "\root\cimv2") >>> >>> >>> Also, when you say you run the script as Administrator, I assume you >>> either right click the script and select "Run as administrator", or you >>> run a command prompt by right clicking cmd.exe and selecting "Run as >>> administrator". Being authenticated to the machine with administrator >>> credentials no longer will work. Finally, which is line 6? >>> >>> -- >>> Richard Mueller >>> MVP Directory Services >>> Hilltop Lab - http://www.rlmueller.net >>> -- >>> >>> >> >> |
|
|
|
|
|||
|
|||
|
Jeremy
Guest
Posts: n/a
|
I have attempted this as a standalone script entering simply "test" as the
description using the exact code in this post with the same result. My startup script is extensive and I do many things on the computer with it. That being said, I take into account all value types returned from AD in my script(s). If you were able to run this code on Win2008 x64, it must either be a hotfix or something else specific to my environment or even the way I am running it? Alex, can you step me through the process you use to run the script? Though I am sure my process for running it is ok, I'm new to Vista/2008 and may be missing something. I start by putting the script on the desktop. I then run cmd.exe as administrator by right clicking and choosing to run as administrator. Then change my directory to the desktop folder where the ..vbs file is located. I then type the name of the file to run it. Thanks for the help "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OUx%23$... > I've tried the demo code and have no trouble at all with it on Vista > Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server > x64. > > Did you try the _modified_ version on the computer, the one that simply > sets the description as you showed? I'm asking because I suspect the error > message could be correct with AD data in some circumstances. Depending on > what you're pulling from where in AD, the value you return may not be a > standard text string. > > If you find a generic description can be set successfully, I suggest you > next look at the data you're returning from AD to use as the description. > I would check two things: the typename for the returned value, and then - > if it appears to be a single string - I suggest escaping the data and > displaying it, to check for possible odd characters. > > WScript.Echo TypeName(AdDescription) > WScript.Echo Escape(AdDescription) > > "Jeremy" <trombone79atgmail.com> wrote in message > news:... >> I run from a command prompt that I righ-click to run as administrator. >> There is no option in the context menu on a .vbs file. >> >> Setting the impersonationLevel=impersonate yields exactle the same >> result. I have tried with and without it. >> >> The error Line (line 6 in my error) is x.Put_ . >> >> Thanks for your reply. >> >> >> Sorry to everyone about the double post. >> >> "Richard Mueller [MVP]" <rlmueller-> wrote in >> message news:... >>> >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:... >>>>I have been doing this for years in XP and Server 2003, but recently I >>>>have been installing Vista x64 Edition for some specific needs. This >>>>code is part of a workstation startup script that pulls the description >>>>from AD and makes it the local description on the computer. This does >>>>not work in Vista x64 or Server 2008 x64 and I have found no explanation >>>>on the Internet as of yet. I have not tested in x86 installs of the >>>>same OS. Yes, I am running it as administrator while testing, if I do >>>>not, I receive Access Denied. >>>> >>>> >>>> sComputer = "." >>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>> For Each x In Obj >>>> x.Description = "This is the computer description." >>>> x.Put_ >>>> Next >>>> >>>> >>>> The object is being created just fine. I can use other methods on the >>>> object successfully like GetText_ . I have found no documentation that >>>> says Put_ shouldn't work. >>>> Any help would be appreciated. This one is driving me crazy. >>>> >>>> When running, I receive the following error: >>>> --------------------------- >>>> Windows Script Host >>>> --------------------------- >>>> Script: C:\Users\username\Desktop\test.vbs >>>> Line: 6 >>>> Char: 4 >>>> Error: Value out of range >>>> Code: 8004102B >>>> Source: SWbemObjectEx >>>> >>>> --------------------------- >>>> OK >>>> --------------------------- >>>> >>>> Thanks >>> >>> >>> Does it help to specify impersonationLevel and authenticationLevel when >>> you connect with WMI? For example: >>> >>> strComputer = "." >>> Set objWMIService = GetObject("winmgmts:" _ >>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>> & strComputer & "\root\cimv2") >>> >>> >>> Also, when you say you run the script as Administrator, I assume you >>> either right click the script and select "Run as administrator", or you >>> run a command prompt by right clicking cmd.exe and selecting "Run as >>> administrator". Being authenticated to the machine with administrator >>> credentials no longer will work. Finally, which is line 6? >>> >>> -- >>> Richard Mueller >>> MVP Directory Services >>> Hilltop Lab - http://www.rlmueller.net >>> -- >>> >>> >> >> |
|
|
|
|
|||
|
|||
|
Alex K. Angelopoulos
Guest
Posts: n/a
|
You're running it exactly the way I do. What do you mean by same result?
Same result as I get, or the same type mismatch error that you got before? "Jeremy" <trombone79atgmail.com> wrote in message news:... > I have attempted this as a standalone script entering simply "test" as the > description using the exact code in this post with the same result. > > My startup script is extensive and I do many things on the computer with > it. That being said, I take into account all value types returned from AD > in my script(s). > > If you were able to run this code on Win2008 x64, it must either be a > hotfix or something else specific to my environment or even the way I am > running it? > > Alex, can you step me through the process you use to run the script? > Though I am sure my process for running it is ok, I'm new to Vista/2008 > and may be missing something. I start by putting the script on the > desktop. I then run cmd.exe as administrator by right clicking and > choosing to run as administrator. Then change my directory to the desktop > folder where the .vbs file is located. I then type the name of the file > to run it. > > Thanks for the help > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:OUx%23$... >> I've tried the demo code and have no trouble at all with it on Vista >> Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server >> x64. >> >> Did you try the _modified_ version on the computer, the one that simply >> sets the description as you showed? I'm asking because I suspect the >> error message could be correct with AD data in some circumstances. >> Depending on what you're pulling from where in AD, the value you return >> may not be a standard text string. >> >> If you find a generic description can be set successfully, I suggest you >> next look at the data you're returning from AD to use as the description. >> I would check two things: the typename for the returned value, and then - >> if it appears to be a single string - I suggest escaping the data and >> displaying it, to check for possible odd characters. >> >> WScript.Echo TypeName(AdDescription) >> WScript.Echo Escape(AdDescription) >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:... >>> I run from a command prompt that I righ-click to run as administrator. >>> There is no option in the context menu on a .vbs file. >>> >>> Setting the impersonationLevel=impersonate yields exactle the same >>> result. I have tried with and without it. >>> >>> The error Line (line 6 in my error) is x.Put_ . >>> >>> Thanks for your reply. >>> >>> >>> Sorry to everyone about the double post. >>> >>> "Richard Mueller [MVP]" <rlmueller-> wrote in >>> message news:... >>>> >>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>> news:... >>>>>I have been doing this for years in XP and Server 2003, but recently I >>>>>have been installing Vista x64 Edition for some specific needs. This >>>>>code is part of a workstation startup script that pulls the description >>>>>from AD and makes it the local description on the computer. This does >>>>>not work in Vista x64 or Server 2008 x64 and I have found no >>>>>explanation on the Internet as of yet. I have not tested in x86 >>>>>installs of the same OS. Yes, I am running it as administrator while >>>>>testing, if I do not, I receive Access Denied. >>>>> >>>>> >>>>> sComputer = "." >>>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>>> For Each x In Obj >>>>> x.Description = "This is the computer description." >>>>> x.Put_ >>>>> Next >>>>> >>>>> >>>>> The object is being created just fine. I can use other methods on the >>>>> object successfully like GetText_ . I have found no documentation >>>>> that says Put_ shouldn't work. >>>>> Any help would be appreciated. This one is driving me crazy. >>>>> >>>>> When running, I receive the following error: >>>>> --------------------------- >>>>> Windows Script Host >>>>> --------------------------- >>>>> Script: C:\Users\username\Desktop\test.vbs >>>>> Line: 6 >>>>> Char: 4 >>>>> Error: Value out of range >>>>> Code: 8004102B >>>>> Source: SWbemObjectEx >>>>> >>>>> --------------------------- >>>>> OK >>>>> --------------------------- >>>>> >>>>> Thanks >>>> >>>> >>>> Does it help to specify impersonationLevel and authenticationLevel when >>>> you connect with WMI? For example: >>>> >>>> strComputer = "." >>>> Set objWMIService = GetObject("winmgmts:" _ >>>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>>> & strComputer & "\root\cimv2") >>>> >>>> >>>> Also, when you say you run the script as Administrator, I assume you >>>> either right click the script and select "Run as administrator", or you >>>> run a command prompt by right clicking cmd.exe and selecting "Run as >>>> administrator". Being authenticated to the machine with administrator >>>> credentials no longer will work. Finally, which is line 6? >>>> >>>> -- >>>> Richard Mueller >>>> MVP Directory Services >>>> Hilltop Lab - http://www.rlmueller.net >>>> -- >>>> >>>> >>> >>> > > |
|
|
|
|
|||
|
|||
|
Alex K. Angelopoulos
Guest
Posts: n/a
|
Ignore my previous post. I can confirm that on Vista 32-bit I get the same
error as you do IF the description has already been set to some value: Error: Value out of range Code: 8004102B Source: SWbemObjectEx So I can confirm it's apparently an issue with doing a put_ in the environment when a value is already set, and it appears to happen on 32-bit Vista as well - but not 64-bit Vista or 2008 Server. I've tried running the test following a reboot and get the same error back. I initially tried setting some flags on the Put_() method but Vista doesn't appear to like that. What's weird is the error that we get back; it's not only undocumented in the Put_ method docs, but when it _has_ been reported in the past (on XP) it has been a meaningful message - people trying to create a page file that's too large, for example. I'm trying to find a way to look inside the problem now. "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:eEOQlk#... > You're running it exactly the way I do. What do you mean by same result? > Same result as I get, or the same type mismatch error that you got before? > > "Jeremy" <trombone79atgmail.com> wrote in message > news:... >> I have attempted this as a standalone script entering simply "test" as >> the description using the exact code in this post with the same result. >> >> My startup script is extensive and I do many things on the computer with >> it. That being said, I take into account all value types returned from AD >> in my script(s). >> >> If you were able to run this code on Win2008 x64, it must either be a >> hotfix or something else specific to my environment or even the way I am >> running it? >> >> Alex, can you step me through the process you use to run the script? >> Though I am sure my process for running it is ok, I'm new to Vista/2008 >> and may be missing something. I start by putting the script on the >> desktop. I then run cmd.exe as administrator by right clicking and >> choosing to run as administrator. Then change my directory to the >> desktop folder where the .vbs file is located. I then type the name of >> the file to run it. >> >> Thanks for the help >> >> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >> news:OUx%23$... >>> I've tried the demo code and have no trouble at all with it on Vista >>> Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server >>> x64. >>> >>> Did you try the _modified_ version on the computer, the one that simply >>> sets the description as you showed? I'm asking because I suspect the >>> error message could be correct with AD data in some circumstances. >>> Depending on what you're pulling from where in AD, the value you return >>> may not be a standard text string. >>> >>> If you find a generic description can be set successfully, I suggest you >>> next look at the data you're returning from AD to use as the >>> description. I would check two things: the typename for the returned >>> value, and then - if it appears to be a single string - I suggest >>> escaping the data and displaying it, to check for possible odd >>> characters. >>> >>> WScript.Echo TypeName(AdDescription) >>> WScript.Echo Escape(AdDescription) >>> >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:... >>>> I run from a command prompt that I righ-click to run as administrator. >>>> There is no option in the context menu on a .vbs file. >>>> >>>> Setting the impersonationLevel=impersonate yields exactle the same >>>> result. I have tried with and without it. >>>> >>>> The error Line (line 6 in my error) is x.Put_ . >>>> >>>> Thanks for your reply. >>>> >>>> >>>> Sorry to everyone about the double post. >>>> >>>> "Richard Mueller [MVP]" <rlmueller-> wrote >>>> in message news:... >>>>> >>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>> news:... >>>>>>I have been doing this for years in XP and Server 2003, but recently I >>>>>>have been installing Vista x64 Edition for some specific needs. This >>>>>>code is part of a workstation startup script that pulls the >>>>>>description from AD and makes it the local description on the >>>>>>computer. This does not work in Vista x64 or Server 2008 x64 and I >>>>>>have found no explanation on the Internet as of yet. I have not >>>>>>tested in x86 installs of the same OS. Yes, I am running it as >>>>>>administrator while testing, if I do not, I receive Access Denied. >>>>>> >>>>>> >>>>>> sComputer = "." >>>>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>>>> For Each x In Obj >>>>>> x.Description = "This is the computer description." >>>>>> x.Put_ >>>>>> Next >>>>>> >>>>>> >>>>>> The object is being created just fine. I can use other methods on >>>>>> the object successfully like GetText_ . I have found no >>>>>> documentation that says Put_ shouldn't work. >>>>>> Any help would be appreciated. This one is driving me crazy. >>>>>> >>>>>> When running, I receive the following error: >>>>>> --------------------------- >>>>>> Windows Script Host >>>>>> --------------------------- >>>>>> Script: C:\Users\username\Desktop\test.vbs >>>>>> Line: 6 >>>>>> Char: 4 >>>>>> Error: Value out of range >>>>>> Code: 8004102B >>>>>> Source: SWbemObjectEx >>>>>> >>>>>> --------------------------- >>>>>> OK >>>>>> --------------------------- >>>>>> >>>>>> Thanks >>>>> >>>>> >>>>> Does it help to specify impersonationLevel and authenticationLevel >>>>> when you connect with WMI? For example: >>>>> >>>>> strComputer = "." >>>>> Set objWMIService = GetObject("winmgmts:" _ >>>>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>>>> & strComputer & "\root\cimv2") >>>>> >>>>> >>>>> Also, when you say you run the script as Administrator, I assume you >>>>> either right click the script and select "Run as administrator", or >>>>> you run a command prompt by right clicking cmd.exe and selecting "Run >>>>> as administrator". Being authenticated to the machine with >>>>> administrator credentials no longer will work. Finally, which is line >>>>> 6? >>>>> >>>>> -- >>>>> Richard Mueller >>>>> MVP Directory Services >>>>> Hilltop Lab - http://www.rlmueller.net >>>>> -- >>>>> >>>>> >>>> >>>> >> >> |
|
|
|
|
|||
|
|||
|
Alex K. Angelopoulos
Guest
Posts: n/a
|
I'm getting nothing useful from trying to explore the Description property.
I _do_ have a workaround for this specific scenario; you can set a computer's description either locally or remotely by directly going to the registry value backing it. It works fine using WMI's StdRegProv. Unfortunately, it doesn't explain why this particular problem happens. strComputer = "." Set reg = GetObject("winmgmts:\\"&_ strComputer & "\root\default:StdRegProv") regpath = "SYSTEM\CurrentControlSet\Services\LanmanServer\Pa rameters" value = "New Description for the computer" returned = reg.SetStringValue( &H80000002, regpath, "srvcomment", value) WScript.Echo returned ' returned error, which should be 0 "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:ecRKI5#... > Ignore my previous post. I can confirm that on Vista 32-bit I get the same > error as you do IF the description has already been set to some value: > Error: Value out of range > Code: 8004102B > Source: SWbemObjectEx > > So I can confirm it's apparently an issue with doing a put_ in the > environment when a value is already set, and it appears to happen on > 32-bit Vista as well - but not 64-bit Vista or 2008 Server. I've tried > running the test following a reboot and get the same error back. > > I initially tried setting some flags on the Put_() method but Vista > doesn't appear to like that. What's weird is the error that we get back; > it's not only undocumented in the Put_ method docs, but when it _has_ been > reported in the past (on XP) it has been a meaningful message - people > trying to create a page file that's too large, for example. > > I'm trying to find a way to look inside the problem now. > > > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:eEOQlk#... >> You're running it exactly the way I do. What do you mean by same result? >> Same result as I get, or the same type mismatch error that you got >> before? >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:... >>> I have attempted this as a standalone script entering simply "test" as >>> the description using the exact code in this post with the same result. >>> >>> My startup script is extensive and I do many things on the computer with >>> it. That being said, I take into account all value types returned from >>> AD in my script(s). >>> >>> If you were able to run this code on Win2008 x64, it must either be a >>> hotfix or something else specific to my environment or even the way I am >>> running it? >>> >>> Alex, can you step me through the process you use to run the script? >>> Though I am sure my process for running it is ok, I'm new to Vista/2008 >>> and may be missing something. I start by putting the script on the >>> desktop. I then run cmd.exe as administrator by right clicking and >>> choosing to run as administrator. Then change my directory to the >>> desktop folder where the .vbs file is located. I then type the name of >>> the file to run it. >>> >>> Thanks for the help >>> >>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>> news:OUx%23$... >>>> I've tried the demo code and have no trouble at all with it on Vista >>>> Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server >>>> x64. >>>> >>>> Did you try the _modified_ version on the computer, the one that simply >>>> sets the description as you showed? I'm asking because I suspect the >>>> error message could be correct with AD data in some circumstances. >>>> Depending on what you're pulling from where in AD, the value you return >>>> may not be a standard text string. >>>> >>>> If you find a generic description can be set successfully, I suggest >>>> you next look at the data you're returning from AD to use as the >>>> description. I would check two things: the typename for the returned >>>> value, and then - if it appears to be a single string - I suggest >>>> escaping the data and displaying it, to check for possible odd >>>> characters. >>>> >>>> WScript.Echo TypeName(AdDescription) >>>> WScript.Echo Escape(AdDescription) >>>> >>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>> news:... >>>>> I run from a command prompt that I righ-click to run as administrator. >>>>> There is no option in the context menu on a .vbs file. >>>>> >>>>> Setting the impersonationLevel=impersonate yields exactle the same >>>>> result. I have tried with and without it. >>>>> >>>>> The error Line (line 6 in my error) is x.Put_ . >>>>> >>>>> Thanks for your reply. >>>>> >>>>> >>>>> Sorry to everyone about the double post. >>>>> >>>>> "Richard Mueller [MVP]" <rlmueller-> wrote >>>>> in message news:... >>>>>> >>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>> news:... >>>>>>>I have been doing this for years in XP and Server 2003, but recently >>>>>>>I have been installing Vista x64 Edition for some specific needs. >>>>>>>This code is part of a workstation startup script that pulls the >>>>>>>description from AD and makes it the local description on the >>>>>>>computer. This does not work in Vista x64 or Server 2008 x64 and I >>>>>>>have found no explanation on the Internet as of yet. I have not >>>>>>>tested in x86 installs of the same OS. Yes, I am running it as >>>>>>>administrator while testing, if I do not, I receive Access Denied. >>>>>>> >>>>>>> >>>>>>> sComputer = "." >>>>>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>>>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>>>>> For Each x In Obj >>>>>>> x.Description = "This is the computer description." >>>>>>> x.Put_ >>>>>>> Next >>>>>>> >>>>>>> >>>>>>> The object is being created just fine. I can use other methods on >>>>>>> the object successfully like GetText_ . I have found no >>>>>>> documentation that says Put_ shouldn't work. >>>>>>> Any help would be appreciated. This one is driving me crazy. >>>>>>> >>>>>>> When running, I receive the following error: >>>>>>> --------------------------- >>>>>>> Windows Script Host >>>>>>> --------------------------- >>>>>>> Script: C:\Users\username\Desktop\test.vbs >>>>>>> Line: 6 >>>>>>> Char: 4 >>>>>>> Error: Value out of range >>>>>>> Code: 8004102B >>>>>>> Source: SWbemObjectEx >>>>>>> >>>>>>> --------------------------- >>>>>>> OK >>>>>>> --------------------------- >>>>>>> >>>>>>> Thanks >>>>>> >>>>>> >>>>>> Does it help to specify impersonationLevel and authenticationLevel >>>>>> when you connect with WMI? For example: >>>>>> >>>>>> strComputer = "." >>>>>> Set objWMIService = GetObject("winmgmts:" _ >>>>>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>>>>> & strComputer & "\root\cimv2") >>>>>> >>>>>> >>>>>> Also, when you say you run the script as Administrator, I assume you >>>>>> either right click the script and select "Run as administrator", or >>>>>> you run a command prompt by right clicking cmd.exe and selecting "Run >>>>>> as administrator". Being authenticated to the machine with >>>>>> administrator credentials no longer will work. Finally, which is line >>>>>> 6? >>>>>> >>>>>> -- >>>>>> Richard Mueller >>>>>> MVP Directory Services >>>>>> Hilltop Lab - http://www.rlmueller.net >>>>>> -- >>>>>> >>>>>> >>>>> >>>>> >>> >>> |
|
|
|
|
|||
|
|||
|
Alex K. Angelopoulos
Guest
Posts: n/a
|
And one more self-spamming post. ; )
I'm finding the error occurs with the Put_() method against other WMI properties on Vista x86. I also tried disabling UAC temporarily, and even enabling the standard administrator account and logging in with it. Same results. I went on to try using CIM_OperatingSystem instead of Win32_OperatingSystem, and get the same error value back. I'm not finding any reports of this specific issue with Vista, however. "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:ecRKI5#... > Ignore my previous post. I can confirm that on Vista 32-bit I get the same > error as you do IF the description has already been set to some value: > Error: Value out of range > Code: 8004102B > Source: SWbemObjectEx > > So I can confirm it's apparently an issue with doing a put_ in the > environment when a value is already set, and it appears to happen on > 32-bit Vista as well - but not 64-bit Vista or 2008 Server. I've tried > running the test following a reboot and get the same error back. > > I initially tried setting some flags on the Put_() method but Vista > doesn't appear to like that. What's weird is the error that we get back; > it's not only undocumented in the Put_ method docs, but when it _has_ been > reported in the past (on XP) it has been a meaningful message - people > trying to create a page file that's too large, for example. > > I'm trying to find a way to look inside the problem now. > > > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:eEOQlk#... >> You're running it exactly the way I do. What do you mean by same result? >> Same result as I get, or the same type mismatch error that you got >> before? >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:... >>> I have attempted this as a standalone script entering simply "test" as >>> the description using the exact code in this post with the same result. >>> >>> My startup script is extensive and I do many things on the computer with >>> it. That being said, I take into account all value types returned from >>> AD in my script(s). >>> >>> If you were able to run this code on Win2008 x64, it must either be a >>> hotfix or something else specific to my environment or even the way I am >>> running it? >>> >>> Alex, can you step me through the process you use to run the script? >>> Though I am sure my process for running it is ok, I'm new to Vista/2008 >>> and may be missing something. I start by putting the script on the >>> desktop. I then run cmd.exe as administrator by right clicking and >>> choosing to run as administrator. Then change my directory to the >>> desktop folder where the .vbs file is located. I then type the name of >>> the file to run it. >>> >>> Thanks for the help >>> >>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>> news:OUx%23$... >>>> I've tried the demo code and have no trouble at all with it on Vista >>>> Business Edition (32-bit), Win 7 Beta build 7000 x64, or Win2008 Server >>>> x64. >>>> >>>> Did you try the _modified_ version on the computer, the one that simply >>>> sets the description as you showed? I'm asking because I suspect the >>>> error message could be correct with AD data in some circumstances. >>>> Depending on what you're pulling from where in AD, the value you return >>>> may not be a standard text string. >>>> >>>> If you find a generic description can be set successfully, I suggest >>>> you next look at the data you're returning from AD to use as the >>>> description. I would check two things: the typename for the returned >>>> value, and then - if it appears to be a single string - I suggest >>>> escaping the data and displaying it, to check for possible odd >>>> characters. >>>> >>>> WScript.Echo TypeName(AdDescription) >>>> WScript.Echo Escape(AdDescription) >>>> >>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>> news:... >>>>> I run from a command prompt that I righ-click to run as administrator. >>>>> There is no option in the context menu on a .vbs file. >>>>> >>>>> Setting the impersonationLevel=impersonate yields exactle the same >>>>> result. I have tried with and without it. >>>>> >>>>> The error Line (line 6 in my error) is x.Put_ . >>>>> >>>>> Thanks for your reply. >>>>> >>>>> >>>>> Sorry to everyone about the double post. >>>>> >>>>> "Richard Mueller [MVP]" <rlmueller-> wrote >>>>> in message news:... >>>>>> >>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>> news:... >>>>>>>I have been doing this for years in XP and Server 2003, but recently >>>>>>>I have been installing Vista x64 Edition for some specific needs. >>>>>>>This code is part of a workstation startup script that pulls the >>>>>>>description from AD and makes it the local description on the >>>>>>>computer. This does not work in Vista x64 or Server 2008 x64 and I >>>>>>>have found no explanation on the Internet as of yet. I have not >>>>>>>tested in x86 installs of the same OS. Yes, I am running it as >>>>>>>administrator while testing, if I do not, I receive Access Denied. >>>>>>> >>>>>>> >>>>>>> sComputer = "." >>>>>>> Set Obj = GetObject("winmgmts:\\" & sComputer & >>>>>>> "\root\cimv2").InstancesOf("Win32_OperatingSystem" ) >>>>>>> For Each x In Obj >>>>>>> x.Description = "This is the computer description." >>>>>>> x.Put_ >>>>>>> Next >>>>>>> >>>>>>> >>>>>>> The object is being created just fine. I can use other methods on >>>>>>> the object successfully like GetText_ . I have found no >>>>>>> documentation that says Put_ shouldn't work. >>>>>>> Any help would be appreciated. This one is driving me crazy. >>>>>>> >>>>>>> When running, I receive the following error: >>>>>>> --------------------------- >>>>>>> Windows Script Host >>>>>>> --------------------------- >>>>>>> Script: C:\Users\username\Desktop\test.vbs >>>>>>> Line: 6 >>>>>>> Char: 4 >>>>>>> Error: Value out of range >>>>>>> Code: 8004102B >>>>>>> Source: SWbemObjectEx >>>>>>> >>>>>>> --------------------------- >>>>>>> OK >>>>>>> --------------------------- >>>>>>> >>>>>>> Thanks >>>>>> >>>>>> >>>>>> Does it help to specify impersonationLevel and authenticationLevel >>>>>> when you connect with WMI? For example: >>>>>> >>>>>> strComputer = "." >>>>>> Set objWMIService = GetObject("winmgmts:" _ >>>>>> & "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _ >>>>>> & strComputer & "\root\cimv2") >>>>>> >>>>>> >>>>>> Also, when you say you run the script as Administrator, I assume you >>>>>> either right click the script and select "Run as administrator", or >>>>>> you run a command prompt by right clicking cmd.exe and selecting "Run >>>>>> as administrator". Being authenticated to the machine with >>>>>> administrator credentials no longer will work. Finally, which is line >>>>>> 6? >>>>>> >>>>>> -- >>>>>> Richard Mueller >>>>>> MVP Directory Services >>>>>> Hilltop Lab - http://www.rlmueller.net >>>>>> -- >>>>>> >>>>>> >>>>> >>>>> >>> >>> |
|
|
|
|
|||
|
|||
|
|
|
| |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use VBScript to Set Local Computer Description | Jeremy | Windows Vista General Discussion | 19 | 06-05-2009 11:18 PM |
| Set Local Computer Description | Jeremy | Windows Vista General Discussion | 9 | 05-05-2009 07:37 PM |
| Sync AD computer description field with local computer description field. | Michael | Scripting | 4 | 02-09-2009 05:20 PM |
| Re: Change active directory computer description to local computer description | Scripting | 0 | 02-28-2006 03:51 PM | |
| sync the computer description field in AD with the computer description field on the my computer properties computername tab | Glenn L | Scripting | 1 | 04-05-2005 12:18 PM |
Forum Software Powered by vBulletin®, Copyright Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc. |



Linear Mode

