modifying values w/ script. permissions problem?

T

this.tech.guy

hi,

i'm trying to get chkdsk running on my win2k workstations once in a
while through this script:

<script>

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "BootExecute"
arrStringValues = Array("autocheck autochk /r \??\E:", "autocheck
autochk /r \??\D:", "autocheck autochk /r \??\C:", "autocheck autochk
*")

oReg.SetMultiStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

</script>

while i am able to create and delete values in this key, i can't
modify them. which i find a little strange btw

of course, a similar script will work correctly in another hive
(software, for instance)

so i had a careful look at permissions for this, besides, at this
point, i am still testing it as domain admin.

while all reason points to a permissions issue, i can't figure it out.

i'm sure someone has a valid explanation for this.

regards,

this.tech.guy
 
M

Mark V

In said:
hi,

i'm trying to get chkdsk running on my win2k workstations once in
a while through this script:

<script>

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
&_ strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "BootExecute"
arrStringValues = Array("autocheck autochk /r \??\E:", "autocheck
autochk /r \??\D:", "autocheck autochk /r \??\C:", "autocheck
autochk *")

oReg.SetMultiStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

</script>

while i am able to create and delete values in this key, i can't
modify them. which i find a little strange btw

of course, a similar script will work correctly in another hive
(software, for instance)

so i had a careful look at permissions for this, besides, at this
point, i am still testing it as domain admin.

while all reason points to a permissions issue, i can't figure it
out.

i'm sure someone has a valid explanation for this.

I cannot address the method you are using but have several comments
for what it is worth.

Using the reg.exe tool one cannot alter a part of a REG_MULTI string.
Just delete and recreate. That may well be true for the API call
used by your script as well. The multiple strings are separated with
a NUL and the data is terminated with a trailing NUL. I am unclear
as to whether your script manages to accomplish that.

autochk.exe as far as I know does not understand "/r" and one cannot
schedule such a chkdsk type check via BootExecute.

The chkntfs.exe utility (fsutil in XP ??) does such alterations for
you but only as specified in chkntfs /?

If I am wrong I will be pleased to learn more.
 
M

Mark V

In said:
hi,

i'm trying to get chkdsk running on my win2k workstations once in
a while through this script:

<script>

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
&_ strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "BootExecute"
arrStringValues = Array("autocheck autochk /r \??\E:", "autocheck
autochk /r \??\D:", "autocheck autochk /r \??\C:", "autocheck
autochk *")

oReg.SetMultiStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

</script>

while i am able to create and delete values in this key, i can't
modify them. which i find a little strange btw

of course, a similar script will work correctly in another hive
(software, for instance)

so i had a careful look at permissions for this, besides, at this
point, i am still testing it as domain admin.

while all reason points to a permissions issue, i can't figure it
out.

i'm sure someone has a valid explanation for this.

All I have are some comments....
When using reg.exe REG_MULTI partial data cannot be altered in place.
Only deleted and recreated. Could that be one of the problems? I do
not know much about your script, but is it succssfully nul-terminating
each string (line) of a multi-string value and adding a final NUL at
the end as required in multi-string data? This is output from REG

! REG.EXE VERSION 2.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
BootExecute REG_MULTI_SZ autocheck autochk /r \??\D:\0autocheck autochk *\0\0
 
T

this.tech.guy

In microsoft.public.win2000.registry this.tech.guy wrote:


i won't be so bold as to suggest you are wrong

here are some clarifications:
I cannot address the method you are using but have several comments
for what it is worth.

Using the reg.exe tool one cannot alter a part of a REG_MULTI string.
Just delete and recreate. That may well be true for the API call
used by your script as well. The multiple strings are separated with
a NUL and the data is terminated with a trailing NUL. I am unclear
as to whether your script manages to accomplish that.

Create a MultiString Value:
Description
Uses WMI to create a string a multi-string value

http://www.microsoft.com/technet/community/scriptcenter/registry/scrreg04.mspx

I have tested the suggested script with success as to what it claims
it does. values are modified, in the software hive though.
autochk.exe as far as I know does not understand "/r" and one cannot
schedule such a chkdsk type check via BootExecute.

it is not real scheduling. this value, if modified, will have autochk
call chkdsk on next reboot, though. then you can reboot your
workstations with another script, let's say, for maintenance, once a
week.

Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools in Windows
2000:

http://support.microsoft.com/default.aspx?scid=kb;en-us;218461

you are right: autochk does not support the /r switch according to
this. however, this switch is the one that tells chkdsk to attempt
recovery of lost data. when entered manually, it seems to be passed to
chkdsk achieveing desired results. maybe i was just lucky.
The chkntfs.exe utility (fsutil in XP ??) does such alterations for
you but only as specified in chkntfs /?

If I am wrong I will be pleased to learn more.

thank you for a reply
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top