Author: arkurth Date: Mon Jun 1 19:41:22 2009 New Revision: 780798 URL: http://svn.apache.org/viewvc?rev=780798&view=rev Log: VCL-23 Added prepare_newsid() to Windows_mod.pm. It configures a computer to automatically call the run_newsid.cmd script the next time a user logs on. Also removed call to enable_autoadminlogon() from pre_capture(). The prepare_newsid() or Sysprep script files control this.
Fixed accidental exit call that got saved in Vista_mod.pm. Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6/Vista_mod.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm?rev=780798&r1=780797&r2=780798&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm Mon Jun 1 19:41:22 2009 @@ -323,17 +323,6 @@ =item * -Enable autoadminlogon - -=cut - - if (!$self->enable_autoadminlogon()) { - notify($ERRORS{'WARNING'}, 0, "unable to enable autoadminlogon"); - return 0; - } - -=item * - Set sshd service startup mode to manual =cut @@ -2794,6 +2783,74 @@ #///////////////////////////////////////////////////////////////////////////// +=head2 prepare_newsid + + Parameters : None. + Returns : If successful: true + If failed: false + Description : This subroutine prepares a computer to automatically run + newsid.exe the next time it is booted. Newsid.exe is a utility + which generates a new SID (security identifier) for the computer. + + This subroutine enables autoadminlogon so that root automatically + logs on the next time the computer is booted. + + A registry key is created under + HKLM\Software\Microsoft\Windows\CurrentVersion\Run. + This key calls the run_newsid.cmd script. This script will run + as root when it automatically logs on. + + The run_newsid.cmd script runs newsid.exe, removes the HKLM...Run + key which caused itself to be called, and configures another + HKLM...Run key to call post_load.cmd at next logon. The script + then reboots the computer. + +=cut + +sub prepare_newsid { + my $self = shift; + if (ref($self) !~ /windows/i) { + notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method"); + return; + } + + my $management_node_keys = $self->data->get_management_node_keys(); + my $computer_node_name = $self->data->get_computer_node_name(); + my $end_state = $self->{end_state} || 'off'; + + # Get the node configuration directory + my $node_configuration_directory = $self->get_node_configuration_directory(); + unless ($node_configuration_directory) { + notify($ERRORS{'WARNING'}, 0, "node configuration directory could not be determined"); + return; + } + + # Add HKLM run key to call run_newsid.cmd after the image comes up + if (!$self->add_hklm_run_registry_key('run_newsid.cmd', $node_configuration_directory . '/Scripts/run_newsid.cmd >> ' . $node_configuration_directory . '/Logs/run_newsid.log')) { + notify($ERRORS{'WARNING'}, 0, "unable to create run key to call run_newsid.cmd"); + return; + } + + # Enable autoadminlogon + if (!$self->enable_autoadminlogon()) { + notify($ERRORS{'WARNING'}, 0, "unable to enable autoadminlogon"); + return 0; + } + + exit; + # Shut down computer unless end_state argument was passed with a value other than 'off' + if ($end_state eq 'off') { + if (!$self->shutdown()) { + notify($ERRORS{'WARNING'}, 0, "failed to shut down computer"); + return; + } + } + + return 1; +} + +#///////////////////////////////////////////////////////////////////////////// + =head2 run_newsid Parameters : Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6/Vista_mod.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6/Vista_mod.pm?rev=780798&r1=780797&r2=780798&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6/Vista_mod.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod/Version_6/Vista_mod.pm Mon Jun 1 19:41:22 2009 @@ -129,7 +129,7 @@ return; } } -exit; + notify($ERRORS{'OK'}, 0, "returning 1"); return 1; } ## end sub pre_capture