Posts posted by Doc Symbiosis
-
-
-
-
Perhaps have a try with the following vb script:
It only asks for the data and then runs the command
"netsh interface ip set address source=static name="Local Area Connection" addr=xxx.xxx.xxx.xxx mask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx 1"
Set wshshell = CreateObject("WScript.Shell")
ip = "134.76.210.86"
subnet ="255.255.0.0"
gateway ="134.76.210.254"
'msg = "Want you to set a static IP? "& VbCr &"(If no DHCP is enabled)?"
antwort = MsgBox(msg, vbYesNo + vbQuestion)
if antwort = vbNo then
befehl ="netsh interface ip set address source=dhcp name= "&"""Local Area Connection"""
command = "%COMSPEC% /C " & befehl
resultat = wshshell.Run ( kommando, 1, True )
befehl ="netsh interface ip delete dns name="&"""Local Area Connection""" & " addr=all"
command = "%COMSPEC% /C " & befehl
resultat = wshshell.Run ( kommando, 1, True )
befehl ="netsh interface ip delete wins name="&"""Local Area Connection""" & " addr=all"
command = "%COMSPEC% /C " & befehl
resultat = wshshell.Run ( kommando, 1, True )
WScript.Quit
end if
ip_neu = InputBox("Please enter the IP:","Enter IP number", ip )
subnet_neu = InputBox("Please enter subnetmask:","Enter subnetmask", subnet )
gateway_neu = InputBox("Please enter gateway:","Enter gateway", gateway )
befehl ="netsh interface ip set address source=static name= "&"""Local Area Connection"""&" addr="& ip_neu &" mask="& subnet_neu &" gateway="& gateway_neu & " 1"
command = "%COMSPEC% /C " & befehl
resultat = wshshell.Run ( kommando, 1, True )
If Not resultat = 0 Then
MsgBox ("Changing of IP failed")
End If
-
Hi there,
yesterday I came across the problem, that I wanted to run WPI from everywhere, not only from a CD and always came across the error "..windows cannot find....", especially when I tried to run a windows command (e.g. "net use..").
Took me some time to come to a solution and so I thought, I might interest someone else. So here it is. I changed the following to the files:
--------------------------------------------------------------------------------------------------
my WPI.cmd ( basically added the REG ADD and REG DELETE line )
--------------------------------------------
@ECHO OFF
REM Determine the WPI startup path.
set wpipath=%~dp0
REM Font installation - the smooth and customizable way.
start /wait %wpipath%\common\fonts\fontinstaller.exe
REM Special registry tweak needed.
regedit /s "%wpipath%\common\wpi.reg"
REM Make WPI directory the current directory.
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%"
REM Write the actual path to the registry
REG ADD HKCU\Software\WPI /v SWPath /t REG_EXPAND_SZ /d %wpipath% /f
REM Start WPI and wait for its end
start /wait WPI.hta
REM Delete the Key from the registry
REG DELETE HKCU\Software\WPI
exit
:end
---------------------------------------------------------------------------------------------
Then in generate.js I added the following function:
-----------------------------------------------------------
function FindSWPath()
{
position = "generate.js"
swpath = WshShell.regRead("HKCU\Software\WPI\SWPath");
return swpath;
}
----------------------------------------------------------------------------------------
I also added in generate.js the following lines to the function replpath
------------------------------------------------
softwarepathwpath = FindSWPath();
rs = rs.replace(/%swpath%/gi, softwarepath);
---------------------------------------------------------------------------------------------
Now I can use in config.js for example
cmd1[pn]=['%swpath%\\Install\\Mozilla\\setup.exe -ma -ira']
Now there's nothing else for it, but to say:
WPI is really a REALLY GREAT TOOL!
Keep at it!!!
-
You could use the attached script. It asks for the new folder for the userprofiles, copies the folder of default user and all users and sets the entry in the registry, so that new profiles will be generated in the new location. Already existing profiles aren't touched.
Save the following as profiles.vbs and run it
-------------------------------------------------------------------------------------------------
Set wshshell = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
value_user = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Profilelist\ProfilesDirectory"
dir_docs = wshshell.RegRead(value_user)
Do
answer = vbYes
resiltat1 = 0
resultat2 = 0
'Dialog zur Auswahl des Ordners für die Profile öffnen
userfolder = folderbrowse
'Falls Cancel gedrückt wurde, das Skript beenden
If ( userfolder = "" ) Then
WScript.Quit
End If
pos = Instr (userfolder,":")
If NOT ( pos = 2 ) Then
Msgbox userfolder & " is not a valid directory. Please choose another one!"
Else
Set userfolderO = fs.Getfolder(userfolder)
If ( userfolderO.Subfolders.count > 0 ) OR (userfolderO.files.count > 0 ) Then
answer = Msgbox (userfolder &" is not empty. Overwrite?", vbYesNo + vBQuestion)
If ( answer = vbYes) AND (len(userfolder) > 3) Then
On Error Resume Next
fs.Deletefolder(userfolder)
End If
End If
If NOT ( answer = vbNo ) Then
dir_docs = wshshell.ExpandEnvironmentStrings(dir_docs)
befehl ="xcopy /o/h/e/i/y/q """ & dir_docs & "\all users"" """ & userfolder & "\all users"""
kommando = "%COMSPEC% /C " & befehl
resultat1 = wshshell.Run ( kommando, 1, True )
befehl ="xcopy /o/h/e/i/y/q """ & dir_docs & "\default user"" """ & userfolder & "\default user"""
kommando = "%COMSPEC% /C " & befehl
resultat2 = wshshell.Run ( kommando, 1, True )
If ( resultat1 <> 0 ) OR ( resultat2 <> 0 ) Then
msgbox "Copy failed! Please choose another directory"
If (len(userfolder) = 3) Then
On Error Resume Next
fs.Deletefolder(userfolder & """\all users""")
On Error Resume Next
fs.Deletefolder(userfolder & """\default user""")
Else
fs.Deletefolder(userfolder)
End If
End If
End If
End If
loop while (resultat1 <> 0) OR (resultat2 <> 0) OR ( answer =vbNo ) OR ( NOT pos = 2)
wshshell.RegWrite value_user,userfolder
Function folderBrowse
On Error Resume Next
Set slapp = WScript.CreateObject("Shell.Application")
Set V = slapp.BrowseForFolder (0, "Choose the new folder for the userprofiles ( or press cancel, if you don't want to move it)", 0, &H11)
If err.number <> 0 Then
folderBrowse = "Error number " & err.number
err.clear
Exit Function
End If
folderBrowse = V.self.path
End Function
-
How to change profile directory?
in Unattended Windows 2000/XP/2003
Which entries do you mean? I use the script since a few months and didn't come across any probglem. But perhaps I overlooked a fault.