Change my computer icon to show computer name. 
Author Message
 Change my computer icon to show computer name.

Using either SMS or Login Script, I would like to change the caption of the
My Computer Icon to state the Network Name of the local computer.

If anyone has done this, could you please advise.

Thank You,

Steve BerkHolz



Fri, 28 Jun 2002 03:00:00 GMT  
 Change my computer icon to show computer name.
You can try the following script, which works for me.  It will require a
reboot to show the change on Win95, but I was able to show the changed name
in Win98 with a refresh of the Desktop.

Option Explicit
Dim ws, cn, mc
set ws = wscript.createobject("wscript.shell")
'get computer name from Registry
on error resume next
cn = ws.regread("HKLM\system\currentcontrolset\" & _
  "control\computername\computername\computername")
if err.number <> 0 then
  msgbox "ComputerName not found in Registry"
  set ws = nothing
  wscript.quit
end if
on error goto 0
'write computer name as new name for my computer.
ws.regwrite "HKCR\CLSID\{20D04FE0" & _
  "-3AEA-1069-A2D8-08002B30309D}\",cn
set ws = nothing

Bill James


Quote:
> Using either SMS or Login Script, I would like to change the caption of
the
> My Computer Icon to state the Network Name of the local computer.

> If anyone has done this, could you please advise.

> Thank You,

> Steve BerkHolz




Fri, 28 Jun 2002 03:00:00 GMT  
 Change my computer icon to show computer name.
You could also utilize Bill's example with SMS installer by reading the
hklm\system\currentcontrolset\control\computername\computername\computername
value and then writing it to:
HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}


Quote:
> Using either SMS or Login Script, I would like to change the caption of
the
> My Computer Icon to state the Network Name of the local computer.

> If anyone has done this, could you please advise.

> Thank You,

> Steve BerkHolz




Sat, 29 Jun 2002 03:00:00 GMT  
 Change my computer icon to show computer name.
Thank You,

This appears to work without fail on 9X and NT4.
But on Windows 2000 RC2, it does change the Key, But the desktop appears to
use the LocalizedString Key.
If this was just MyComputer. I would write to this key also, but it appears
to store other parraimiters.

Here is excerp from reg export:

"InfoTip"="Displays the files and folders on your computer"

Thank You for your assistance.
Steve


Quote:
> You can try the following script, which works for me.  It will require a
> reboot to show the change on Win95, but I was able to show the changed
name
> in Win98 with a refresh of the Desktop.

> Option Explicit
> Dim ws, cn, mc
> set ws = wscript.createobject("wscript.shell")
> 'get computer name from Registry
> on error resume next
> cn = ws.regread("HKLM\system\currentcontrolset\" & _
>   "control\computername\computername\computername")
> if err.number <> 0 then
>   msgbox "ComputerName not found in Registry"
>   set ws = nothing
>   wscript.quit
> end if
> on error goto 0
> 'write computer name as new name for my computer.
> ws.regwrite "HKCR\CLSID\{20D04FE0" & _
>   "-3AEA-1069-A2D8-08002B30309D}\",cn
> set ws = nothing

> Bill James



> > Using either SMS or Login Script, I would like to change the caption of
> the
> > My Computer Icon to state the Network Name of the local computer.

> > If anyone has done this, could you please advise.

> > Thank You,

> > Steve BerkHolz




Sat, 29 Jun 2002 03:00:00 GMT  
 Change my computer icon to show computer name.

Steve,

I have a KiXtart script that does this in the login script.  It works
for me on 95, 98, NT4, Win200 build 2195.

I can't attach files to this post, so I have pasted it below.  Might be
pretty ugly re-formatting it, so let me know if you want it emailed to
you.

________________________________

GoTo "_Main"

;Last Modified=1999/12/29
;Last Modifier=Marty List
;Last Modification=Modified to support changes in Windows 2000

;===============================================================;
;                                                               ;
; This script renames the 'My Computer' icon on the desktop to  ;
; the current Computer Name and IP Address.                     ;
;                                                               ;
; Please contact Marty List for any questions or changes.       ;
;                                                               ;
;===============================================================;

;===============================================================;
:_Main          If $Debug  ? "========= Executing MyComputer.KiX. . .
==========" ?  EndIf
;===============================================================;

If $AdminID = "" $AdminID = "JM18205"               EndIf
If $AdminMachine = "" $AdminMachine = "IT-031"      EndIf
$ExitCode = 13
$ExitFailed = 10
$ExitSuccess = 0
$FontDPI = 0
$IPTemp = ""
$IconSpacingKey = ""
$MinIconSpacing = ""
$MyComputerKey = ""
$MyComputerCLSID = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"

$ResultCode = 0
$WindowsNT = 1
$Windows9x = 2

; Check for the IE4 integrated shell (Active Desktop), Win98, Win2000,
etc.:
Select
;=======================================================================
;
Case $Platform = $WindowsNT And $WinVer = "4.0"
;=======================================================================
;
        ; Check for the IE4 integrated shell (Active Desktop):
        $ResultCode = ReadValue
("HKEY_LOCAL_MACHINE\Software\Microsoft\Active
Setup\InstallInfo", "Integrated Shell")

                $MyComputerKey
= "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\"+$MyComputerCLSID
                $IconSpacingKey = "HKEY_CURRENT_USER\Control
Panel\Desktop\WindowMetrics"
                $MinIconSpacing = -1455
        Else
                $MyComputerKey
= "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\"+$MyComputerCLSID
                $IconSpacingKey = "HKEY_CURRENT_USER\Control
Panel\Desktop"

                ; Icon spacing is different depending on 'Small Fonts'
or 'Large Fonts':
                $FontDPI = ReadValue
("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\FontDPI", "LogPixels")
                If Val($FontDPI) <= 60
                        $MinIconSpacing = 102
                Else
                        $MinIconSpacing = 152
                EndIf
        EndIf

        $IconSpacing = ReadValue($IconSpacingKey, "IconSpacing")
        $IconSpacing = Val($IconSpacing)
        If $IconSpacing >= $MinIconSpacing
                $MinIconSpacing = 0
        EndIf

;=======================================================================
;
Case $Platform = $WindowsNT And $WinVer = "5.0"
;=======================================================================
;
        $MyComputerKey
= "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
CLSID\"+$MyComputerCLSID
        $IconSpacingKey = "HKEY_CURRENT_USER\Control
Panel\Desktop\WindowMetrics"
        $MinIconSpacing = "-1530"

        $IconSpacing = ReadValue($IconSpacingKey, "IconSpacing")
        $IconSpacing = Val($IconSpacing)
        If $IconSpacing <= $MinIconSpacing
                $MinIconSpacing = 0
        EndIf

;=======================================================================
;
Case $Platform = $Windows9x And $WinVer = "4.0"
;=======================================================================
;

;=======================================================================
;
Case $Platform = $Windows9x And $WinVer = "4.10"
;=======================================================================
;

;=======================================================================
;
Case 1  ;Default, Case Else:
;=======================================================================
;
        $Message = "WARNING: MyComputer.KiX failed to find an OS
definition"
        Call $ScriptDir+"\NotifyAdmin.KiX"

        $ExitCode = $ExitFailed

;=======================================================================
;
EndSelect
;=======================================================================
;

If $Debug
        ? "$$MyComputerKey: ["+$MyComputerKey+"]"
        ? "$$IconSpacingKey: ["+$IconSpacingKey+"]"
        ? "$$IconSpacing: ["+$IconSpacing+"]"
        ? "$$MinIconSpacing: ["+$MinIconSpacing+"]"
EndIf

If $NewMyCompName = ""
        If $IPAddressTrim = ""
                If $Debug  ? "$$Location="+$Location+",
$$Connection="+$Connection+" - calling GetLocation.KiX"  EndIf
                Call $ScriptDir+"\GetLocation.KiX"
        EndIf

        If $IPAddressTrim

        Else

                $Message = "WARNING: MyComputer.KiX failed to resolve
$$IPAddressTrim from GetLocation.KiX"
                GoSub "_Notify"
                $ExitCode = $ExitFailed
        EndIf
EndIf

If $Debug  ? "$$NewMyCompName: ["+$NewMyCompName+"]"  EndIf

;? "Renaming the My Computer icon to $NewMyCompName..." ?

$ResultCode = AddKey("$MyComputerKey")
$ResultCode = WriteValue
("$MyComputerKey", "", "$NewMyCompName", "REG_SZ")

If $ResultCode = 0
        If $MinIconSpacing <> 0
                $ResultCode = WriteValue
("$IconSpacingKey", "IconSpacing", "$MinIconSpacing", "REG_SZ")

                If $ResultCode <> 0
                        $ExitCode = $ExitFailed
                        $Message = "WARNING: MyComputer.KiX failed,
WriteValue("+$IconSpacingKey+", IconSpacing, "+$MinIconSpacing+")
returned "+$ResultCode
                        GoSub "_Notify"
                EndIf
        EndIf
Else
        $ExitCode = $ExitFailed
        $Message = "WARNING: MyComputer.KiX failed, WriteValue
("+$MyComputerKey+", , "+$NewMyCompName+") returned "+$ResultCode
        GoSub "_Notify"
EndIf

If $ExitCode <> $ExitFailed
        $ExitCode = $ExitSuccess
EndIf

GoTo "_Exit"
;===============================================================;

;===============================================================;
:_Notify                If $Debug  ? "========== Entering _Notify
==========" ?  EndIf
;===============================================================;
If $Message = ""
        $Message = "WARNING: MyComputer.KiX failed and then called
_Notify() with an empty $$Message variable"
EndIf

If Exist($ScriptDir+"\NotifyAdmin.KiX")
        Call $ScriptDir+"\NotifyAdmin.KiX"
Else



        $ResultCode = SendMessage($AdminMachine, $Message)
        If $ResultCode <> 0  $ResultCode = SendMessage($AdminID,
$Message)  EndIf
EndIf

$Message = ""

Return
;===============================================================;

;===============================================================;
;===============================================================;
:_Exit          If $Debug  ? "========= Exiting MyComputer.KiX with
$$ExitCode "+$ExitCode+". . . ==========" ?  EndIf
;===============================================================;
;===============================================================;

Exit $ExitCode

________________________________



Quote:
> Using either SMS or Login Script, I would like to change the caption
of the
> My Computer Icon to state the Network Name of the local computer.

> If anyone has done this, could you please advise.

> Thank You,

> Steve BerkHolz


Sent via Deja.com http://www.deja.com/
Before you buy.


Tue, 02 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Returning Computer Name based on Computer Descipription

2. Change Computer Name via Script

3. How to Change Computer Name .....

4. changing computer name and domain

5. Changing computer name

6. Change Computer Name in NT

7. Change Computer Name in NT

8. How could one change a computer name

9. Changing Computer and Workgroup Names

10. Change computer name

11. changing computer name and domain

12. Change Computer Name

 

 
Powered by phpBB® Forum Software