[REPO/HOW-TO/CHAT] Audit/Sysprep/Generalize; Setupcomplete/Firstlogon; Silent Install

Discussion in 'Scripting' started by s1ave77, Feb 11, 2017.

  1. dracul

    dracul MDL Novice

    Apr 29, 2015
    9
    1
    0
    Yes, I did keep it.
    Even tried with:
    [Channel]
    _Default

    [VL]
    0

    as suggest earlier in this thread, but no success either...
     
  2. Pl call setupcomplete.cmd at Post OOBE process ie after first user login via autounattend.xml that way it will work in any scenario. no need to cross check sku's or VOLUME / kms - RETAIL /hwid - OEM /hwid or kms38 licence key too in this.
     
  3. dracul

    dracul MDL Novice

    Apr 29, 2015
    9
    1
    0
    That is what I thought, but why did MS state that OEM keys disabled setupcomplete.cmd and only Enterprise editions were able to execute it, left me puzzled...
     
  4. After some time calling first logon scripts at post oobe process will also be disabled via M$ . they are doing s**t in every scenario to make users puzzled & users will leave using there operating systems.
     
  5. dracul

    dracul MDL Novice

    Apr 29, 2015
    9
    1
    0
    Unfortunately, I must upgrade to W11 (W10). Believe me, if I had any choice I would still be using my W7 OS that took me 2 year to fully customize...
     
  6. #206 Deleted member 1385001, Oct 27, 2021
    Last edited by a moderator: Oct 27, 2021
    Simplix Updated W7 Plus Abbodi1406 suggested telemetry removal script is awesome & no any later win builds can defeat it in any way.
    W10 is so so but Believe me w11 is a total s**t.
     
  7. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,191
    94,421
    450
    #207 Enthousiast, Oct 29, 2021
    Last edited: Oct 29, 2021
    That doesn't go for the normal enterprise sku.

    All consumer and business SKUs can run setupcomplete.cmd. Consumer ISOs can readout the MSDM and in that case the scripts won't run without using a working ei.cfg, but i doubt your system has one for Enterprise (and enterprise contains the VL ei.cfg so that would and should skip the MSDM/OEM stuff).

    How did you setup the $OEM$ folder and where is it placed in the ISO?
     
  8. dracul

    dracul MDL Novice

    Apr 29, 2015
    9
    1
    0
    Dear Enthousiast,

    Sorry for the late reply, but some how I managed to get it working by deleting the EI.CFG file in sources directory, and applying a Enterprise Key to autounattend.xml at the root of my ISO.

    The $OEM$ directory was immediately under SOURCES dir, as it should be.

    Don't know why it wasn't working, but the procedures above fixed the issue... Anyway, I think I will stick with LTSC as is less bloated than W11, and how...

    I do thank you all for helping me in this matter.

    Regards...
     
  9. Clear Logs Script assuming All Event Logs already disabled in All Schannels:

    Code:
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in Windows' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%Windir%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%Windir%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%Windir%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%Windir%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%Windir%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%Windir%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in SystemDrive' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%SystemDrive%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%SystemDrive%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%SystemDrive%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in SystemDrive-Users' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%SystemDrive%\Users" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%\Users" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%SystemDrive%\Users" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%\Users" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%SystemDrive%\Users" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%SystemDrive%\Users" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in ProgramData' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%ProgramData%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramData%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramData%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramData%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramData%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramData%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in ProgramFiles' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%ProgramFiles%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramFiles%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramFiles%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Write-Host 'Removing Logs in ProgramFiles(x86)' -EA SilentlyContinue -ForegroundColor Green -Verbose"
    FORFILES /P "%ProgramFiles(x86)%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles(x86)%" /S /M *.log /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramFiles(x86)%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles(x86)%" /S /M *.etl /C "CMD /C IF @ISDIR==FALSE DEL /F /Q @FILE"
    FORFILES /P "%ProgramFiles(x86)%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE ECHO @FILE @PATH @FSIZE @FDATE @FTIME"
    FORFILES /P "%ProgramFiles(x86)%" /S /M Logs /C "CMD /C IF @ISDIR==TRUE RD /S /Q @FILE"
    
    
     
  10. Reset TaskBar Tray cache All Old Unavailable Portable Apps cache will be removed from settings-personalization-taskbar-select which icons appear on taskbar :

    Code:
    taskkill /f /im explorer.exe & TIMEOUT /T 5 /NOBREAK
    DEL /F /S /Q /A %LocalAppData%\Microsoft\Windows\Explorer\thumbcache_*.db
    DEL /F /S /Q /A %LocalAppData%\Microsoft\Windows\Explorer\iconcache_*.db
    DEL /F /S /Q /A %LocalAppData%\Microsoft\Windows\Explorer\ExplorerStartupLog_*.etl
    reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "IconStreams" /f
    reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream" /f
    start explorer.exe & TIMEOUT /T 5 /NOBREAK
    
     
  11. Install Virtualbox via SetupComplete using bat script including its extension Pack :

    Code:
    
    @echo off
    color 0A
    cd /d %~dp0
    Powershell -C "Write-Host 'Installing Virtualbox' -ForegroundColor Green -Verbose"
    START /WAIT "%windir%\System32\msiexec.exe" /i "VirtualBox.msi" VBOX_INSTALLDESKTOPSHORTCUT=0 VBOX_INSTALLQUICKLAUNCHSHORTCUT=0 VBOX_REGISTERFILEEXTENSIONS=0 /qn
    echo y | "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" extpack install --replace "Oracle_VM_VirtualBox_Extension_Pack-6.1.38.vbox-extpack"
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" metrics disable *
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setextradata global GUI/HostNetworkManager/Details/Expanded ""
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setextradata global GUI/Input/HostKeyCombination "162,164"
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setextradata global GUI/UpdateDate "never"
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setproperty machinefolder %UserProfile%\
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setproperty hwvirtexclusive on
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" setproperty websrvauthlibrary null
    "%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" hostonlyif remove "VirtualBox Host-Only Ethernet Adapter"
    for %%z in (
    VBoxNetAdp
    VBoxNetLwf
    VBoxUSBMon
    ) do (
    Powershell -C "SP -Path 'HKLM:SYSTEM\ControlSet001\Services\%%z' -Name Start -Value 4 -EA 0 -Verbose"
    )
    Powershell -C "Write-Host 'Finished Installing Virtualbox' -ForegroundColor Green -Verbose"
    
    
     
  12. haz367

    haz367 MDL Addicted

    Jan 11, 2020
    796
    1,439
    30

    W7 ftw!!

    :boxing::dunno::annoyed:





    :doofywave:
     
  13. #213 Deleted member 1531038, Sep 11, 2022
    Last edited by a moderator: Sep 11, 2022
    Pl try GSudo instead of PowerRun & NSudo . Awesome.

    Code:
    gsudo - a sudo for Windows
    
    gsudo is a sudo equivalent for Windows, with a similar user-experience as the original *nix sudo. It allows to run commands with elevated permissions, or to elevate the current shell, in the current console window or a new one.
    Just prepend gsudo (or the sudo alias) to your command and it will run elevated. One UAC popup will appear each time. You can see less popups if you enable gsudo cache.
    Why use gsudo instead of some-other-sudo?
    gsudo is very easy to install and use. Its similarities with Unix/Linux sudo make the experience a breeze. It detects your current shell and elevates accordingly (as native shell commands). (Supports Cmd, PowerShell, git-bash, MinGW, Cygwin, Yori, Take Command)
    [SIZE=5][B]Features[/B][/SIZE]
    
    [LIST]
    [*]Elevated commands are shown in the current user-level console. No new window. (Unless you specify -n which opens a new window.)
    [*]Credentials cache: gsudo can elevate many times showing only one UAC pop-up if the user opts-in to enable the cache.
    [*]Supports CMD commands: gsudo md folder (no need to use the longer form gsudo cmd.exe /c md folder)
    [*]Elevates PowerShell/PowerShell Core commands, WSL commands, Bash for Windows (Git-Bash/MinGW/MSYS2/Cygwin), Yori or Take Command shell commands.
    [*]Supports being used on scripts:
    [LIST]
    [*]Outputs of the elevated commands can be interpreted: E.g. StdOut/StdErr can be piped or captured (e.g. gsudo dir | findstr /c:"bytes free" > FreeSpace.txt) and exit codes too (%errorlevel%). If gsudo fails to elevate, the exit code will be 999.
    [*]If gsudo is invoked from an already elevated console, it will just run the command (it won't fail). So, you don't have to worry if you run gsudo or a script that uses gsudo from an already elevated console. (The UAC popup will not appear, as no elevation is required)
    [/LIST]
    [*]gsudo !! elevates the last executed command. Works on CMD, Git-Bash, MinGW, Cygwin (and PowerShell with gsudo module only)
    [/LIST]
    Note: gsudo is portable. No windows service is required or system change is done, except adding gsudo to the Path.
    [SIZE=5][B]Usage[/B][/SIZE]
    
    gsudo Opens an elevated shell in the current console.
    gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.
    Most relevant [options]:
    [LIST]
    [*]-n | --new Starts the command in a new console with elevated rights (and returns immediately).
    [*]-w | --wait Force wait for the process to end (and return the exitcode).
    [*]-s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").
    [*]-i | --integrity {v} Run command with a specific integrity level: Low, Medium, MediumPlus, High (default), System. For example, use Low to launch a restricted process, or use Medium to run without Admin rights.
    [*]-d | --direct Execute {command} directly. Does not wrap it with your current shell (Pwsh/WSL/MinGw/Yori/etc). Assumes it is a CMD command (eg. an .EXE file).
    [*]--loadProfile When elevating PowerShell commands, do load profiles.
    [*]--copyns Reconnect current connected network shares on the elevated session. Warning! This is verbose, affects the elevated user system-wide (other processes), and can prompt for credentials interactively.
    [*]--debug Debug mode (verbose).
    [/LIST]
    gsudo config Show current user-settings.
    gsudo config {key} ["value" | --reset] Read, write, or reset a user setting to the default value.
    gsudo status Show status information about current user, security, integrity level or other gsudo relevant data.
    Note: You can use anywhere the sudo alias created by the installers.
    Examples:
    gsudo   # elevates the current shell in the current console window (Supports Cmd/PowerShell/Pwsh Core/Yori/Take Command/git-bash/cygwin)
    
    gsudo -n # launch the current shell elevated in a new console window
    
    gsudo -n -w powershell ./Do-Something.ps1 # launch in new window and wait for exit
    
    gsudo notepad %windir%\system32\drivers\etc\hosts # launch windows app
    
    sudo notepad # sudo alias built-in
    
    # redirect/pipe input/output/error example
    gsudo dir | findstr /c:"bytes free" > FreeSpace.txt
    
    gsudo config LogLevel "Error"          # Configure Reduced logging
    gsudo config Prompt "$P [elevated]$G " # Configure a custom Elevated Prompt
    gsudo config Prompt --reset            # Reset to default value
    
    # Enable credentials cache (less UAC popups):
    gsudo config CacheMode Auto
    
    # Elevate last command (sudo bang bang)
    gsudo !!
    
    [SIZE=5][B]Usage from PowerShell / PowerShell Core[/B][/SIZE]
    
    gsudo detects if it's invoked from PowerShell and elevates PS commands (unless -d is used to elevate CMD commands).
    [LIST]
    [*]Prepend gsudo for commands without special operators ()|&<> or single quotes ', just prepend gsudo. Otherwise you can pass a string literal with the command to be elevate:
    PS C:\> gsudo 'powershell string command'
    Note that the gsudo command returns a string that can be captured, not powershell objects. It will ran elevated, in a different process and lexical scope, so it can't access your existing $variables, so use literal values instead of $vars
    [*]Use Invoke-gsudo CmdLet to elevate a ScriptBlock (allowing better PowerShell syntax validation and auto-complete), with auto serialization of inputs and outputs and pipeline objects.
    The ScriptBlock will ran elevated in a different process and lexical scope, so it can't access your existing $variables, but if you use $using:variableName syntax, it´s serialized value will be applied. The result object is serialized and returned (as an object).
    [*]For a enhanced experience: Import module gsudoModule.psd1 into your Profile: (also enables gsudo !! on PS)
    [/LIST]
    # Add the following line to your $PROFILE (replace with full path)
       Import-Module 'C:\FullPathTo\gsudoModule.psd1'
    # Or run:
       Get-Command gsudoModule.psd1 | % { Write-Output "`nImport-Module `"$($_.Source)`"" | Add-Content $PROFILE }
    [LIST]
    [*]You can create a custom alias for gsudo or Invoke-gsudo, as you prefer: (add one of these lines to your $PROFILE)
    [LIST]
    [*]Set-Alias 'sudo' 'gsudo' or
    [*]Set-Alias 'sudo' 'Invoke-gsudo'
    [/LIST]
    [/LIST]
    Examples:
    # Elevate PowerShell itself
    PS C:\> gsudo
    
    # Elevate Commands without ()|&<>' by prepending gsudo
    gsudo Remove-Item ProtectedFile.txt
    # Or pass a string literal:
    gsudo 'Remove-Item ProtectedFile.txt'
    $hash = gsudo '(Get-FileHash "C:\My Secret.txt").Hash'
    
    # Variable substitutions example:
    $file='C:\My Secret.txt'; $algorithm='md5';
    $hash = gsudo "(Get-FileHash '$file' -Algorithm $algorithm).Hash"
    # or
    $hash = gsudo "(Get-FileHash ""$file"" -Algorithm $algorithm).Hash"
    
    # Skip PowerShell wrapper (with -d): run an .EXE or a CMD command directly (optional, faster)
    gsudo -d notepad
    
    # Test gsudo success (optional):
    if ($LastExitCode -eq 999 ) {
        'gsudo failed to elevate!'
    } elseif ($LastExitCode) {
        'Command failed!'
    } else { 'Success!' }
    Invoke-gsudo examples:
    # Accepts pipeline input.
    Get-process SpoolSv | Invoke-gsudo { Stop-Process -Force }
    
    # Variable usage
    $folder = "C:\ProtectedFolder"
    Invoke-gsudo { Remove-Item $using:folder }
    
    # The result is serialized (PSObject) with properties.
    (Invoke-gsudo { Get-ChildItem $using:folder }).LastWriteTime
    
    
    [SIZE=5][B]Usage from WSL (Windows Subsystem for Linux)[/B][/SIZE]
    
    On WSL, elevation and root are different concepts. root allows full administration of WSL but not the windows system. Use WSL's native su or sudo to gain root access. To get admin privilege on the Windows box you need to elevate the WSL.EXE process. gsudo allows that (a UAC popup will appear).
    On WSL bash, prepend gsudo to elevate WSL commands or gsudo -d for CMD commands.
    # elevate default shell
    PC:~$ gsudo
    
    # run elevated WSL command
    PC:~$ gsudo mkdir /mnt/c/Windows/MyFolder
    
    # run elevated Windows command
    PC:~$ gsudo -d notepad C:/Windows/System32/drivers/etc/hosts
    PC:~$ gsudo -d "notepad C:\Windows\System32\drivers\etc\hosts"
    PC:~$ gsudo -d "echo 127.0.0.1 www.MyWeb.com >> %windir%\System32\drivers\etc\hosts"
    
    # test for gsudo and command success
    retval=$?;
    if [ $retval -eq 0 ]; then
        echo "Success";
    elif [ $retval -eq $((999 % 256)) ]; then # gsudo failure exit code (999) is read as 231 on wsl (999 mod 256)
        echo "gsudo failed to elevate!";
    else
        echo "Command failed with exit code $retval";
    fi;
    
    
     
  14. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    3,727
    5,170
    120
    no have any problem's with NSudo
    so don't have a plan to replace it
    ( very good tool )
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. yes its nice but gsudo --debug arg is awesome .
     
  16. Code:
    
    @echo off & title Mydigitallife Script Projects & color 0A & SETLOCAL
    Set UseExpresssion=Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
    for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSEdition=%%X
    Set OSEdition=%OSEdition:*REG_SZ    =%
    If Defined ProgramFiles(x86) (Set OSType=x64) Else (Set OSType=x86)
    Set UseExpresssion=Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ReleaseId"
    for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSVersion=%%X
    Set OSVersion=%OSVersion:*REG_SZ    =%
    If %OSVersion% LSS 2009 GoTo BuildNo
    Set UseExpresssion=Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "DisplayVersion"
    for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSVersion=%%X
    Set OSVersion=%OSVersion:*REG_SZ    =%
    
    :BuildNo
    Set UseExpresssion=Ver
    for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSBuild=%%X
    Set OSBuild=%OSBuild:*10.0.=%
    Set OSBuild=%OSBuild:~0,-1%
    echo.
    echo:                                        OPERATING SYSTEM INFORMATION
    echo:     WinEdition: %OSEdition% ^| WinArch: %OSType% ^| WinVersion: %OSVersion% ^| WinBuild: %OSBuild%
    
    echo:                                       your script coding starts here
    
    EndLocal
    pause
    exit
    
    
     
  17. Install VMWARE Workstation via SetupComplete using bat script :

    Code:
    Powershell -C "Write-Host 'Installing VMware Workstation' -ForegroundColor Green -Verbose"
    START /WAIT "%windir%\System32\msiexec.exe" /i "VMwareWorkstation.msi" EULAS_AGREED=1 AUTOSOFTWAREUPDATE=0 DATACOLLECTION=0 DESKTOP_SHORTCUT=0 SERIALNUMBER=*****-*****-*****-*****-***** /quiet /passive /qn /norestart
    Powershell -C "Write-Host 'Finished Installing VMware Workstation' -ForegroundColor Green -Verbose"
    echo.
    Powershell -C "Write-Host 'Setting up VMware' -ForegroundColor Green -Verbose"
    sc stop "VMAuthdService" & sc config "VMAuthdService" start=demand
    sc stop "VMnetDHCP" & sc config "VMnetDHCP" start=demand
    sc stop "VMware NAT Service" & sc config "VMware NAT Service" start=demand
    sc stop "VMUSBArbService" & sc config "VMUSBArbService" start=demand
    sc stop "VMwareHostd" & sc config "VMwareHostd" start=demand
    "%ProgramFiles(x86)%\VMware\VMware Workstation\vmnetcfg.exe"
    Powershell -C "Write-Host 'Finished Setting Up VMware' -ForegroundColor Green -Verbose"
    
    Pl Put your License key in serial number :)
    vmnetcfg is called in last via bat script to remove vmware network adaptors if not needed :)
     
  18. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    Hello friends !
    Is possible to run a cleanup folder in RunOnceEx :
    Code:
    IF EXIST %windir%\Setup\scripts RD /S /Q %windir%\Setup\scripts >nul
    
    Beacuse I don't know how is work, if my script clean the folder I can't deploye software, and when I open the session, all is again in setup\script
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. Hi my dear friend Chibi . How are you .
    Why not use setupcomplete & remove a directory or a file via commands from that.
    is there some thing specific which needs to be done by runonce reg key :)
     
  20. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    3,727
    5,170
    120
    Decided tp upgrade my $OEM$ folder

    Partition Tool,
    to create as many UEFI style partition (during setup)

    you just need to refresh partition list, and choice the partition [1,2,3,4,5 ...]

    Code:
    
    @cls
    @echo off
    >nul chcp 437
    setlocal enabledelayedexpansion
    
    rem UEFI/GPT-based hard drive partitions
    rem https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions?view=windows-11
    
    set "f_Name=%~n0"
    
    if "%~1"=="" echo:&echo ERR ### MISSING DISK ID VALUE & echo ERR ### MISSING DISK SIZE VALUE & echo:& Goto:ERR
    if "%~2"=="" echo:&echo ERR ### MISSING DISK SIZE VALUE & echo:& Goto:ERR
    
    call :verify_Number %~1
    if not defined IsNum echo:&echo ERR ### BAD VALUE & echo:& Goto:ERR
    
    call :verify_Number %~2
    if not defined IsNum echo:&echo ERR ### BAD VALUE & echo:& Goto:ERR
    
    set Disk_ID_Size=
    set Disk_ID_Type=
    set Disk_ID_Found=
    for /f "tokens=1,2,3,4,5,6,7,8,9" %%a in ('"echo List Disk | Diskpart"') do if /i "%%a" EQU "Disk" if /i "%%b" NEQ "###" if "%%b" EQU "%~1" (
        set    "Disk_ID_Type=%%e"
        set /a "Disk_ID_Size=%%d"
        set     Disk_ID_Found=true
     
    )
    if not defined Disk_ID_Found echo:&echo ERR ### DISK ID NOT FOUND & echo:& Goto:ERR
    if /i "!Disk_ID_Type!" EQU "GB" set /a "Disk_ID_Size=!Disk_ID_Size!*1024"
    if /i "!Disk_ID_Type!" EQU "TB" set /a "Disk_ID_Size=!Disk_ID_Size!*1024*1024"
    set /a "Disk_ID_Size-=116"
    
    (
        echo select disk %~1
        echo clean
        echo convert GPT
        echo create partition primary size=100 id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
        echo create partition primary size=16  id=e3c9e316-0b5c-4db8-817d-f92df00215ae
    )  >X:\SCRIPT.txt
    
    shift
    shift
    
    :Loop
    if "%~0" NEQ "" (
        call :verify_Number %~0
        if defined IsNum (
            >>X:\SCRIPT.txt echo Create Partition Primary size=%~0 id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
            set /a "Disk_ID_Size-=%~0"
            shift
            goto :Loop
        )
        echo:&echo ERR ### BAD VALUE & echo:& Goto:ERR
    )
    if !Disk_ID_Size! LSS 5 echo:&echo ERR ### NOT ENOUGHT SPACE & echo:& Goto:ERR
    
    (
        echo select partition 1
        echo FORMAT FS=FAT32 QUICK
        echo ASSIGN LETTER=S
    ) >>X:\SCRIPT.txt
    
    diskpart /s X:\SCRIPT.txt
    
    echo:
    pushd s:\
    for %%$ in (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,T,U,V,W,X,Y,Z) do if exist %%$:\EFI xcopy %%$:\EFI EFI /y /h /q /f /i /s /c
    cd EFI\Microsoft\Boot
    bcdedit /store BCD /delete {default}
    popd
    
    (
        echo SELECT VOLUME=S
        echo REMOVE LETTER=S
    ) >X:\SCRIPT.txt
    diskpart /s X:\SCRIPT.txt
    
    echo:
    echo:
    echo:
    echo Done, now press refresh.
    echo:
    goto :eof
    
    :ERR
    echo How to use ^?
    echo:
    echo - Create 2 Partition For Windows 10 ^& Windows 11 On Disk [0]
    echo "%f_Name%" 0 30000 30000
    echo:
    echo Available Disk List
    echo ---------------------
    for /f "tokens=1,2,3,4,5,6,7,8,9" %%a in ('"echo List Disk | Diskpart"') do (
        if /i "%%a" EQU "Disk" if /i "%%b" NEQ "###" echo Disk %%b - Total Size [%%d %%e]
    )
    goto :eof
    
    :verify_Number
    set IsNum=
    2>nul set /a "TestVal=%*"
    if "!TestVal!" EQU "%*" set IsNum=True
    goto :eof
    

    Upgraded setup-complete.
    - allow will load any archive file (7z,zip,rar)
    - auto import Reg file's (found in local directory)
    - auto load any cmd/bat file in another CMD shell
    - in case archive, must contain "proc.cmd" file

    Code:
    rem this script will run before
    rem any user log in
    
    @cls
    @echo off
    title setupcomplete Helper file
    
    echo:
    cd /d "%~dp0"
    
    for /f "tokens=*" %%$ in ('"2>nul dir /a/b *.reg"') do (
        echo Process ### %%$
        call reg import "%~dp0%%$"
    )
    for /f "tokens=*" %%$ in ('"2>nul dir /a/b *.bat"') do (
        echo Process ### %%$
        start "" /wait /min "cmd" /c call "%~dp0%%$"
    )
    for /f "tokens=*" %%$ in ('"2>nul dir /a/b *.cmd"') do (
        if /i "%%$" NEQ "%~nx0" (
            echo Process ### %%$
            start "" /wait /min "cmd" /c call "%~dp0%%$"
        )
    )
    for %%# in (7z, rar, zip) do (
        for /f "tokens=*" %%$ in ('"2>nul dir /a/b *.%%#"') do (
        
            echo Process ### %%$
            >nul 2>nul rd/s/q "%dp~0%Temp\"
        
            if /i "%%#" EQU "7z"  >nul 2>nul BIN\7z x -o"%dp~0%Temp\" "%%$" *
            if /i "%%#" EQU "zip" >nul 2>nul BIN\7z x -o"%dp~0%Temp\" "%%$" *
            if /i "%%#" EQU "RAR" >nul 2>nul BIN\UnRAR x "%%$" "%dp~0%Temp\"
        
            2>nul pushd "%dp~0%Temp\" && (
                start "" /wait /min "cmd" /c call "proc.cmd"
                popd
            )
        
            REM >nul 2>nul del /q "%%$"
            >nul 2>nul rd/s/q "%dp~0%Temp\"
        )
    )
    
    timeout 2 /nobreak
    exit /b

    Missing Binary file's
    https://www.upload.ee/files/14553784/Bin.rar.html
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...