The VB-script. Very simple just go through the available properties. If the
name starts with "res" set the resource with the same name to enabled or
disabled.
===================
Sub cmiOnBeginBuild(dwFlags)
Dim oProp, oRes
For Each oProp in cmiThis.Properties
If Left(oProp.Name,3) = "res" Then
For Each oRes in cmiThis.Resources
If oRes.DisplayName = oProp.Name Then
oRes.Disabled = Not CBool(oProp.Value)
End If
Next
End If
Next
End Sub
=======================
Another VBS example, my very own AutoLogon. Why, "Allowing auto-resolve to
add Windows Logon to a runtime causes the automatic logon default username to
be overwritten." as described at
http://msdn.microsoft.com/library/d...icrosoftWindowsXPEmbeddedWithServicePack2.asp
Took me a long time to get the reason for my problems. But anyway, I just
added the following script to a custom user component prototyped on "User
Account".
=====================
Sub cmiOnEndBuild(dwFlags)
Dim oProp, bAuto, sName, sPass
'Read AutoLogon, UserName and UserPassword properties
For Each oProp In cmiThis.Properties
If oProp.Name = "ncpAutoLogon" Then
bAuto = CBool(oProp.Value)
ElseIf oProp.Name = "cmiUserPassword" Then
sPass = CStr(oProp.Value)
ElseIf oProp.Name = "cmiUserName" Then
sName = CStr(oProp.Value)
End If
Next
'Write data to registry
If bAuto Then
oPL.TargetRegEdit cRegOpWrite, cRegCondAlways, cmiREG_SZ,
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon",
"DefaultUserName", sName, cmiString
oPL.TargetRegEdit cRegOpWrite, cRegCondAlways, cmiREG_SZ,
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon",
"AltDefaultUserName", sName, cmiString
oPL.TargetRegEdit cRegOpWrite, cRegCondAlways, cmiREG_SZ,
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon",
"DefaultPassword", sPass, cmiString
oPL.TargetRegEdit cRegOpWrite, cRegCondAlways, cmiREG_SZ,
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon",
"AutoAdminLogon", "1", cmiString
End If
End Sub
========================
I use the properties I inhereted from "User Account", for username and
password
and my own ncpAutoLogon property to dicide. The ncpAutoLogon property is set
though the HTML below.
==========================
<HTML>
<HEAD>
<STYLE TYPE="text/css">
<!--
BODY { font: normal 8pt Tahoma; background-color: #FFFFFF; }
P { font: normal 8pt Tahoma; }
TABLE { font: normal 8pt Tahoma; text-align: left; padding: 2px; }
LABEL { font: bold 8pt Tahoma; text-align: left; padding: 2px; }
TD { font: normal 8pt Tahoma; text-align: left; padding: 2px; }
TR { font: normal 8pt Tahoma; text-align: left; padding: 2px; }
-->
</STYLE>
</HEAD>
<BODY>
<hr>
<table>
<caption> </caption>
<tr><td><label for="idCWA">AutoLogon:</label></td></tr>
<tr>
<td>
<SCRIPT type="text/vbscript">
Option Explicit
Dim cmiThis : Set cmiThis = window.external.Instance
Function DisplayCheck()
Dim oProp, sTmp
Set oProp = cmiThis.Properties("ncpAutoLogon")
sTmp = "<tr><td><input type=checkbox "
sTmp = sTmp + "name='id" + oProp.Name + "' "
If CBool(oProp.value) Then sTmp = sTmp + "checked "
sTmp = sTmp + "onClick='Call UpdateProperty(""" + oProp.Name + """,
id" + oProp.Name + ".checked)' "
sTmp = sTmp + "> Enable AutoLogon for this user</td></tr>"
DisplayCheck = sTmp
End Function
Sub UpdateProperty(sName,sVal)
Dim oProp
For Each oProp In cmiThis.Properties
If oProp.Name = sName Then
oProp.Value = CBool(sVal)
End If
Next
End Sub
document.write(DisplayCheck())
</SCRIPT>
</td>
</tr>
</table>
<hr>
</BODY>
</HTML>
===============================
Hope this helps.