Answered by:
MDT2013 outility.RegWrite

Question
-
Hello, Hoping someone here can shed some light on this problem I am having in MDT 2013 in Task Sequence.
I am deploying Windows 2008 R2 OS using MDT 2013. I have a vbscript that I run in State Restore phase in the Task Sequence which essentially edits registry using following lines:
sRegKey="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayItemsDisplay"
sNewRegValue = 1
sRegValue=oUtility.RegWrite(sregkey, sNewRegValue)However, It fails with error:
FAILURE (Err): -2147024891 0x80070005: Invalid root in registry key
However, when I run same script manually on the Server, it runs fine.
Thanks in Advance.
-Deepak
Monday, March 30, 2015 8:19 PM
Answers
-
After I moved my vbscript task further down in State Restore section after "Restore Groups", It seemed to have worked. I don't know why but now it finishes without any errors.
Thanks,
Deepak
- Proposed as answer by Keith GarnerMVP Wednesday, April 1, 2015 3:48 AM
- Marked as answer by Keith GarnerMVP Wednesday, April 1, 2015 3:48 AM
Tuesday, March 31, 2015 6:16 PM
All replies
-
The error code -2147024891 equals to 0x80070005 (Access denied). In general, it is caused by the insufficient privileges.
I tested your script and run it from task sequence. No errors and it did write the key to registry.
How you run it from task sequence?
Tuesday, March 31, 2015 3:46 PM -
Thanks for your response.
I run vbscript in "State Restore Phase" of Task Sequence using "Run Command Line". The command line is "cscript %scriptroot%\myscript.wsf"
The lines in my vbscript are:
On Error Resume Next
Dim sRegKey,sNewRegValue,sRegValue
sRegKey="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayItemsDisplay"
sNewRegValue = 1
sRegValue=oUtility.RegWrite(sregkey, sNewRegValue)
If Err.Number <> 0 Then
oLogging.CreateEntry "Error in procedure Disable_Icons -" & Err.Description,LogTypeInfo
Else
oLogging.CreateEntry "Disabling Icons",LogTypeInfo
End If
On Error Goto 0
Tuesday, March 31, 2015 5:58 PM -
After I moved my vbscript task further down in State Restore section after "Restore Groups", It seemed to have worked. I don't know why but now it finishes without any errors.
Thanks,
Deepak
- Proposed as answer by Keith GarnerMVP Wednesday, April 1, 2015 3:48 AM
- Marked as answer by Keith GarnerMVP Wednesday, April 1, 2015 3:48 AM
Tuesday, March 31, 2015 6:16 PM