If all that is left is setting the environment variables, try using Win32::AdminMisc::SetEnvVar() to finish up the job. It will broadcast the change to all non-dos programs.
-----Original Message----- From: JM [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:17 PM To: 'Ky-Anh Phan'; [EMAIL PROTECTED] Subject: RE: Changing Computer Name - $20??? Here is the code that worked for me Ky-Anh. Your code only half worked. It did not change the Environment var's. . . See the code for more details. . . I don't know if you know much about the Canadian dollar but it's not worth much . . . <grin> ========================= use Win32::AdminMisc; use Win32::TieRegistry ( Delimiter => '/', ArrayValues => 0, TiedRef => \$Registry ); # Function to change the Computer Name with input from the keyboard. print "Please supply a new ComputerName: "; $NewComputerName = <STDIN>; chomp $NewComputerName; $NewComputerName = uc ($NewComputerName); # Use Registry as mentioned by Ky-Anh Phan - Changes the NetBIOS name but # not Env Vars $Registry->{'LMachine/SYSTEM/CurrentControlSet/Control/ComputerName/Comp uter Name/NV ComputerName'} = $NewComputerName; $Registry->{'LMachine/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters /NV Hostname'} = $NewComputerName; # Use David Roth's extension to change the computer name. # Only changes Env Var's Win32::AdminMisc::SetComputerName( $NewComputerName ); -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Ky-Anh Phan Sent: Thursday, March 14, 2002 12:07 PM To: 'JM'; [EMAIL PROTECTED] Subject: RE: Changing Computer Name - $20??? Sorry .. Forgot to specify the value :-) Should set "NV ComputerName" in CurrentControlSet and "NV Hostname" in TcpIp Services For that mistake, I'll take off $5 :D -----Original Message----- From: Ky-Anh Phan Sent: Thursday, March 14, 2002 10:54 AM To: 'JM'; [EMAIL PROTECTED] Subject: RE: Changing Computer Name - $20??? Is this U.S. dollars? :-) use Win32::TieRegistry ( Delimiter => '/', ArrayValues => 0, TiedRef => \$Registry ); $Registry->{'LMachine/SYSTEM/CurrentControlSet/Control/ComputerName/Comp uter Name/NV ComputerName'} = $name; $Registry->{'LMachine/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters /NV Hostname'} = $name; Win32::InitiateSystemShutdown("","Rebooting the computer",5 ,0 ,1); -----Original Message----- From: JM [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 8:01 PM To: [EMAIL PROTECTED] Subject: Changing Computer Name - $20??? Hi I'm trying to change a computer name on a Windows 2000 PC, logged in as Administrator. It changes the Computername ENV. Var. but does not change the NetBIOS name. $20.00 to the first person that can help me get this code to work properly. . . use Win32; use Win32::AdminMisc; Win32::AdminMisc::SetComputerName('BLACKBOX'); Win32::InitiateSystemShutdown("","Rebooting the computer",5 ,0 ,1); The Computer reboots properly . . . _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
