Wabiloo
13th September 2006 08:51 UTC
Changing machine name (hostname)
By using this forum, I found a way of getting the hostname for the current machine.
That was (all things compared) relatively easy...
Now, I'd like my installer to change the computer name... that's much less easy, it seems...
The Glimmerman
13th September 2006 13:24 UTC
This must do the trick
Function GetComputerName
System::Call 'kernel32.dll::GetComputerNameExW(i 4, w .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2'
${If} $2 = 1
StrCpy $Localhost "\\$0"
${Else}
MessageBox MB_OK|MB_ICONSTOP 'Could not determine the computer name!$\nAborting...'
Quit
${EndIf}
System::Free $0
FunctionEnd
Function SetComputerName
System::Call 'kernel32.dll::SetComputerNameExA(i 4,t "$ComputerName")i.r1'
System::Call 'kernel32.dll::SetComputerNameExA(i 5,t "$ComputerName")i.r1'
StrCmp $1 0 +1 +2
System::Call 'kernel32.dll::SetComputerNameA(t "$ComputerName")i .r1'
;System::Call 'kernel32.dll::SetComputerNameEx (i 5,t "$ComputerName") i.r0'
FunctionEnd
The Glimmerman
13th September 2006 13:26 UTC
For User Management info.
Goto this page