|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Use VBScript to Set Local Computer Descriptionbeen 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
Show quote
Hide quote
"Jeremy" <trombone79atgmail.com> wrote in message Does it help to specify impersonationLevel and authenticationLevel when you news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >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 connect with WMI? For example: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,authenticationLevel=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? 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. Show quoteHide quote "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... > > "Jeremy" <trombone79atgmail.com> wrote in message > news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>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,authenticationLevel=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 > -- > > 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) Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... > 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-nospam@ameritech.nospam.net> wrote in > message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>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,authenticationLevel=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 >> -- >> >> > > 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. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OUx%23$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... > 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >> 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-nospam@ameritech.nospam.net> wrote in >> message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>> >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>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,authenticationLevel=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 >>> -- >>> >>> >> >> 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 Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OUx%23$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... > 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >> 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-nospam@ameritech.nospam.net> wrote in >> message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>> >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>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,authenticationLevel=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 >>> -- >>> >>> >> >> 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? Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... > 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>> 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-nospam@ameritech.nospam.net> wrote in >>> message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>> >>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>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,authenticationLevel=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 >>>> -- >>>> >>>> >>> >>> > > 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. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:eEOQlk#yJHA.4412@TK2MSFTNGP06.phx.gbl... > 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>> 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-nospam@ameritech.nospam.net> wrote >>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>> >>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>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,authenticationLevel=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 >>>>> -- >>>>> >>>>> >>>> >>>> >> >> 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\Parameters" value = "New Description for the computer" returned = reg.SetStringValue( &H80000002, regpath, "srvcomment", value) WScript.Echo returned ' returned error, which should be 0 Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:ecRKI5#yJHA.4272@TK2MSFTNGP06.phx.gbl... > 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>> 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-nospam@ameritech.nospam.net> wrote >>>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>> >>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>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,authenticationLevel=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 >>>>>> -- >>>>>> >>>>>> >>>>> >>>>> >>> >>> 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. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:ecRKI5#yJHA.4272@TK2MSFTNGP06.phx.gbl... > 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>> 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-nospam@ameritech.nospam.net> wrote >>>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>> >>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>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,authenticationLevel=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 >>>>>> -- >>>>>> >>>>>> >>>>> >>>>> >>> >>> I confirm the problem on 32-bit Vista, but only if there is no existing
value assigned to the property. I tried Put_(0) and Put_(1) to no avail. I even tried to assign an blank string. I note that the TypeName of the value is unchanged. It was "String" when there was no value, and the same after a value was assigned (so it is not an array). Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:%23Urx6LAzJHA.1372@TK2MSFTNGP05.phx.gbl... > 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#yJHA.4272@TK2MSFTNGP06.phx.gbl... >> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>> 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-nospam@ameritech.nospam.net> wrote >>>>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>> >>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>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,authenticationLevel=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 >>>>>>> -- >>>>>>> >>>>>>> >>>>>> >>>>>> >>>> >>>> In my case, the only installs we have of Vista and 2008 are x64. I've
pretty much tried what you have with the same error returning. What's strange is your x64 installs work fine? If I want to get this thing fixed, do I need to call up Microsoft support? Thanks for all your help. It's good to know I'm not the only one that can reproduce the problem. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... > 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>> 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-nospam@ameritech.nospam.net> wrote >>>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>> >>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>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,authenticationLevel=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" <trombone79atgmail.com> wrote in message I didn't have a Vista x64 install to work against. Based on your prior news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... > In my case, the only installs we have of Vista and 2008 are x64. I've > pretty much tried what you have with the same error returning. What's > strange is your x64 installs work fine? description, I thought you were only encountering the problem on Vista; is that correct? At this point it looks to me like a one-version bug (if that's what it is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any bitness. > If I want to get this thing fixed, do I need to call up Microsoft support? Yes. I think this would be a good point to call Microsoft support; three of us can see the problem, and haven't found a reason or fix. Show quoteHide quote > Thanks for all your help. It's good to know I'm not the only one that can > reproduce the problem. > > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>> 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-nospam@ameritech.nospam.net> wrote >>>>>> in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>> >>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>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,authenticationLevel=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 >>>>>>> -- >>>>>>> >>>>>>> >>>>>> >>>>>> >>>> >>>> > > I can reproduce this on both Vista x64 and Server 2008 x64. Any intstall of
those operating systems in our environment is x64 so I have not tested against x86 versions of the OS. Thanks again. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:eylSxLLzJHA.140@TK2MSFTNGP03.phx.gbl... > "Jeremy" <trombone79atgmail.com> wrote in message > news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... >> In my case, the only installs we have of Vista and 2008 are x64. I've >> pretty much tried what you have with the same error returning. What's >> strange is your x64 installs work fine? > > I didn't have a Vista x64 install to work against. Based on your prior > description, I thought you were only encountering the problem on Vista; is > that correct? > > At this point it looks to me like a one-version bug (if that's what it > is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any > bitness. > >> If I want to get this thing fixed, do I need to call up Microsoft >> support? > > Yes. I think this would be a good point to call Microsoft support; three > of us can see the problem, and haven't found a reason or fix. > >> Thanks for all your help. It's good to know I'm not the only one that >> can reproduce the problem. >> >> >> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >> news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >>> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>> 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-nospam@ameritech.nospam.net> >>>>>>> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>>> >>>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>>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,authenticationLevel=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 >>>>>>>> -- >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>> >>>>> >> >> It now sounds to me more likely to be an erratic bug, possibly fixed in
Vista SP1. The primary reason is the failure you get on 2008x64; since I don't get it, that helps clinch the point that this isn't a consistent problem at a particular OS level. I'm now running diagnostics on WMI on my Vista system to see if that changes anything. I don't have SP1 installed on it either, so I'll try downloading that for the VM and seeing if we get a cure that way. Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:e$oSOHMzJHA.3872@TK2MSFTNGP05.phx.gbl... > I can reproduce this on both Vista x64 and Server 2008 x64. Any intstall > of those operating systems in our environment is x64 so I have not tested > against x86 versions of the OS. > > Thanks again. > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:eylSxLLzJHA.140@TK2MSFTNGP03.phx.gbl... >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... >>> In my case, the only installs we have of Vista and 2008 are x64. I've >>> pretty much tried what you have with the same error returning. What's >>> strange is your x64 installs work fine? >> >> I didn't have a Vista x64 install to work against. Based on your prior >> description, I thought you were only encountering the problem on Vista; >> is that correct? >> >> At this point it looks to me like a one-version bug (if that's what it >> is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any >> bitness. >> >>> If I want to get this thing fixed, do I need to call up Microsoft >>> support? >> >> Yes. I think this would be a good point to call Microsoft support; three >> of us can see the problem, and haven't found a reason or fix. >> >>> Thanks for all your help. It's good to know I'm not the only one that >>> can reproduce the problem. >>> >>> >>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>> news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >>>> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>>>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>>> 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-nospam@ameritech.nospam.net> >>>>>>>> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>>>> >>>>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>>>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,authenticationLevel=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 >>>>>>>>> -- >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>> >>>>>> >>> >>> > > Wmidiag reported no problems. I've installed SP1 and the Put_() still fails.
Barring any other really good ideas, I'd say this is probably time for the technical support call. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OlUKbHQzJHA.3848@TK2MSFTNGP03.phx.gbl... > It now sounds to me more likely to be an erratic bug, possibly fixed in > Vista SP1. The primary reason is the failure you get on 2008x64; since I > don't get it, that helps clinch the point that this isn't a consistent > problem at a particular OS level. > > I'm now running diagnostics on WMI on my Vista system to see if that > changes anything. I don't have SP1 installed on it either, so I'll try > downloading that for the VM and seeing if we get a cure that way. > > > "Jeremy" <trombone79atgmail.com> wrote in message > news:e$oSOHMzJHA.3872@TK2MSFTNGP05.phx.gbl... >> I can reproduce this on both Vista x64 and Server 2008 x64. Any intstall >> of those operating systems in our environment is x64 so I have not tested >> against x86 versions of the OS. >> >> Thanks again. >> >> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >> news:eylSxLLzJHA.140@TK2MSFTNGP03.phx.gbl... >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... >>>> In my case, the only installs we have of Vista and 2008 are x64. I've >>>> pretty much tried what you have with the same error returning. What's >>>> strange is your x64 installs work fine? >>> >>> I didn't have a Vista x64 install to work against. Based on your prior >>> description, I thought you were only encountering the problem on Vista; >>> is that correct? >>> >>> At this point it looks to me like a one-version bug (if that's what it >>> is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any >>> bitness. >>> >>>> If I want to get this thing fixed, do I need to call up Microsoft >>>> support? >>> >>> Yes. I think this would be a good point to call Microsoft support; three >>> of us can see the problem, and haven't found a reason or fix. >>> >>>> Thanks for all your help. It's good to know I'm not the only one that >>>> can reproduce the problem. >>>> >>>> >>>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>>> news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >>>>> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>>>>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>>>> 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-nospam@ameritech.nospam.net> >>>>>>>>> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>>>>> >>>>>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>>>>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,authenticationLevel=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 >>>>>>>>>> -- >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> >>>> >>>> >> >> I have SP1 on all my installs of Vista and 2008 actually. I guess I should
have mentioned that earlier. You're saying that you can replicate it on an RTM install? I have an idea I'm going to try, but I have a feeling I'm dealing with a bug. Show quoteHide quote "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message news:OlUKbHQzJHA.3848@TK2MSFTNGP03.phx.gbl... > It now sounds to me more likely to be an erratic bug, possibly fixed in > Vista SP1. The primary reason is the failure you get on 2008x64; since I > don't get it, that helps clinch the point that this isn't a consistent > problem at a particular OS level. > > I'm now running diagnostics on WMI on my Vista system to see if that > changes anything. I don't have SP1 installed on it either, so I'll try > downloading that for the VM and seeing if we get a cure that way. > > > "Jeremy" <trombone79atgmail.com> wrote in message > news:e$oSOHMzJHA.3872@TK2MSFTNGP05.phx.gbl... >> I can reproduce this on both Vista x64 and Server 2008 x64. Any intstall >> of those operating systems in our environment is x64 so I have not tested >> against x86 versions of the OS. >> >> Thanks again. >> >> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >> news:eylSxLLzJHA.140@TK2MSFTNGP03.phx.gbl... >>> "Jeremy" <trombone79atgmail.com> wrote in message >>> news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... >>>> In my case, the only installs we have of Vista and 2008 are x64. I've >>>> pretty much tried what you have with the same error returning. What's >>>> strange is your x64 installs work fine? >>> >>> I didn't have a Vista x64 install to work against. Based on your prior >>> description, I thought you were only encountering the problem on Vista; >>> is that correct? >>> >>> At this point it looks to me like a one-version bug (if that's what it >>> is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any >>> bitness. >>> >>>> If I want to get this thing fixed, do I need to call up Microsoft >>>> support? >>> >>> Yes. I think this would be a good point to call Microsoft support; three >>> of us can see the problem, and haven't found a reason or fix. >>> >>>> Thanks for all your help. It's good to know I'm not the only one that >>>> can reproduce the problem. >>>> >>>> >>>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>>> news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >>>>> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>>>>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>>>> 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-nospam@ameritech.nospam.net> >>>>>>>>> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>>>>> >>>>>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>>>>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,authenticationLevel=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 >>>>>>>>>> -- >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> >>>> >>>> >> >> Yes. By the way, my current desktop system - which is Win 7 Beta x64
upgraded from Vista Ultimate x64 - there's no problem whatsoever. Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:OE6AzlQzJHA.4520@TK2MSFTNGP05.phx.gbl... > I have SP1 on all my installs of Vista and 2008 actually. I guess I > should have mentioned that earlier. You're saying that you can replicate > it on an RTM install? > > I have an idea I'm going to try, but I have a feeling I'm dealing with a > bug. > > > "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message > news:OlUKbHQzJHA.3848@TK2MSFTNGP03.phx.gbl... >> It now sounds to me more likely to be an erratic bug, possibly fixed in >> Vista SP1. The primary reason is the failure you get on 2008x64; since I >> don't get it, that helps clinch the point that this isn't a consistent >> problem at a particular OS level. >> >> I'm now running diagnostics on WMI on my Vista system to see if that >> changes anything. I don't have SP1 installed on it either, so I'll try >> downloading that for the VM and seeing if we get a cure that way. >> >> >> "Jeremy" <trombone79atgmail.com> wrote in message >> news:e$oSOHMzJHA.3872@TK2MSFTNGP05.phx.gbl... >>> I can reproduce this on both Vista x64 and Server 2008 x64. Any >>> intstall of those operating systems in our environment is x64 so I have >>> not tested against x86 versions of the OS. >>> >>> Thanks again. >>> >>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>> news:eylSxLLzJHA.140@TK2MSFTNGP03.phx.gbl... >>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>> news:#NHwhYBzJHA.4412@TK2MSFTNGP06.phx.gbl... >>>>> In my case, the only installs we have of Vista and 2008 are x64. I've >>>>> pretty much tried what you have with the same error returning. What's >>>>> strange is your x64 installs work fine? >>>> >>>> I didn't have a Vista x64 install to work against. Based on your prior >>>> description, I thought you were only encountering the problem on Vista; >>>> is that correct? >>>> >>>> At this point it looks to me like a one-version bug (if that's what it >>>> is): I get the problem on Vista, but not XP/2003/2008/Win7 Beta of any >>>> bitness. >>>> >>>>> If I want to get this thing fixed, do I need to call up Microsoft >>>>> support? >>>> >>>> Yes. I think this would be a good point to call Microsoft support; >>>> three of us can see the problem, and haven't found a reason or fix. >>>> >>>>> Thanks for all your help. It's good to know I'm not the only one that >>>>> can reproduce the problem. >>>>> >>>>> >>>>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message >>>>> news:ecRKI5%23yJHA.4272@TK2MSFTNGP06.phx.gbl... >>>>>> 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#yJHA.4412@TK2MSFTNGP06.phx.gbl... >>>>>>> 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:ukMqmb4yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>>> 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$D4yJHA.5032@TK2MSFTNGP05.phx.gbl... >>>>>>>>> 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:ubrgkk0yJHA.5684@TK2MSFTNGP04.phx.gbl... >>>>>>>>>> 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-nospam@ameritech.nospam.net> >>>>>>>>>> wrote in message news:OthKXU0yJHA.1380@TK2MSFTNGP05.phx.gbl... >>>>>>>>>>> >>>>>>>>>>> "Jeremy" <trombone79atgmail.com> wrote in message >>>>>>>>>>> news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >>>>>>>>>>>>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,authenticationLevel=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 >>>>>>>>>>> -- >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>> >>>>>>>> >>>>> >>>>> >>> >>> > > One more data point. Using a virtual machine with Vista Ultimate RTM freshly
installed, I used similar code to set the description, and it worked the very first time (as on my other Vista test). Thereafter, Put_ always fails. I haven't been able to find a confirmed case of the problem occurring on Vista with integrated SP1 yet, however. Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... > 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 > Short update, seems that it doesn't work in Server 2008 with SP2 which I
just installed on a server either. Show quoteHide quote "Jeremy" <trombone79atgmail.com> wrote in message news:OjxTslzyJHA.1416@TK2MSFTNGP04.phx.gbl... >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 >
Inventory script question
How do implement this wildcard? Logon script help Issues when launching a vbscript file from hta interface file Get computer name as variable to use in vbs script. Re: Updating AD with a script convert vb script to exe anyone know if this is possible? Check if a list of user IDs exist/disabled looking for a code to add data |
|||||||||||||||||||||||