Jump to content

SmallIcon Desktop with AutoUnattented


Recommended Posts

Hi every one!

In my automatic installation, i will to setting the small Icon of the desktop!

--> I try the first solution : have 3 files

File name : RunVBS.VBS

Set WshShell = CreateObject("Wscript.Shell")Set ofs = CreateObject("Scripting.FileSystemObject")strScriptDir = ofs.GetParentFolderName(Wscript.ScriptFullName)strFile = strScriptDir & "\SmallIcon.vbs"WshShell.Run "C:\Windows\System32\cscript.exe " & Chr(34) & strFile & Chr(34)wscript.sleep 2000strFilea = strScriptDir & "\ReStartExploreWin.vbs"WshShell.Run "C:\Windows\System32\cscript.exe " & Chr(34) & strFilea & Chr(34)

File name : SmallIcon.VBS

'Petite taille : valeur décimal : 32 - valeur Héxadécimal : 20'Moyenne taille : valeur décimal : 48 - valeur Héxadécimal : 30'Grande taille : valeur décimal : 96 - valeur Héxadécimal : 60'-- Il faut kill explorer puis le relancer!Option ExplicitDim objShell, strRoot, strRoot1, strModify, strDeletestrRoot = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags\1\Desktop\IconSize"strRoot1 = "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\Shell Icon Size"' Create the Shell objectSet objShell = CreateObject("WScript.Shell")strModify = objShell.RegWrite(strRoot,"00000032", "REG_DWORD")'WScript.Echo "Error No: " & err.number & " check " & strRootstrModify = nullstrModify = objShell.RegWrite(strRoot1,"32", "REG_SZ")'WScript.Echo "Error No: " & err.number & " check " & strRoot1strModify = nullWScript.Quit' End of .RegWrite example script.

File name : ReStartExploreWin.vbs

On Error Resume Next' Kill Explorer.exestrComputer = "."Set objWMIService = GetObject("winmgmts:" _    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colProcessList = objWMIService.ExecQuery _    ("Select * from Win32_Process Where Name = 'explorer.exe'")For Each objProcess in colProcessList    objProcess.Terminate(1)Next' Launch Explorer.exeSet objShell = CreateObject("Wscript.Shell") objShell.Run "explorer.exe" Set objShell = NothingWscript.exit

--> I try the second solution : have 3 files

File name : REG_RUN.VBS

wscript.exe "c:\vbs\smallicondesktop\invisible.vbs" "c:\vbs\smallicondesktop\iconbur.bat"

File name : Invisible.VBS

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

File name : IconBur.Bat

@echo off taskkill /im explorer.exe /f reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /v IconSize /t REG_DWORD /d 00000032 /f "%windir%\explorer.exe"

With the two solution not work when the automatique installation finish!

I have only windows CLI open!

But when i use it, it work fine!

I try solution with SetupComplete.CMD, it not work to!

I think we should wait for the full automatic configuration of the office to start my three files. would anyone please an idea or solution. thank you in advance

Link to comment
Share on other sites


that is writing the launch of the VBS file is just in AutoUnattend.xml?


<settings pass="oobeSystem">

...

<SynchronousCommand wcm:action="add">

<Description>IconSize Desktop</Description>

<CommandLine>cmd /k start "" /wait cscript %SystemDrive%\VBS\SmallIconDeskTop\script1.vbs</CommandLine>

<Order>2</Order>

</SynchronousCommand>

...

</settings>


thank you in advance for your answwer

Link to comment
Share on other sites

I would use 1 .cmd file and put all your code in it. You can even send output to a file using > operator to see which specific commands are failing. Then reference your .cmd in the FirstLogonCommands.

I presume your scripts work find if you run them manually? For reference, you may be running into a permissions or Session 0 issue.

FirstLogonCommands executes as the logon user (Session 1)

Setupcomplete.cmd executes as the LOCAL SYSTEM (Session 0)

Link to comment
Share on other sites

thank you for oyur answer!

please, can you give more information because is new for me!

you mean, i must put my code vbs or link runing my vbs file into file cmd

and make the runing file cmd in the commande FirstLogonCommands of specialize section?

what is the permission please!

thank you in advance of your answer!

Link to comment
Share on other sites

FirstLogonCommands is in the oobeSystem pass. Put all your commands into a .cmd and then have this in your XML:

			<FirstLogonCommands>                <SynchronousCommand wcm:action="add">                    <Order>1</Order>                    <Description>Run vbs from cmd</Description>                    <CommandLine>cmd /C start /wait c:\path\FirstLog.cmd</CommandLine>                </SynchronousCommand>            </FirstLogonCommands>
I don't use VBS myself because of security messages. Example of how to put VBS into CMD:

cscript c:\path\RunVBS.VBS
Or use wscript if you want.
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...