Hi Guys,
We have Ghost Console creating a backup of several machines and then creating a restore job which will sysprep the machine and strip out the unique information so that it can be re added to our domain as a new workstation. This all works perfectly. But we are trying to automatice Windows registration as well as Office registration. But we seem to be hitting a wall in regard to the way the job runs,
From what I have read the Ghost console when running a task does so with the LocalSystem account, The scripts which are in Batch files appear to be running but not completing. If I run them when logged in as a user I get the prompts from the script (there appear mandatory but it would register windows before the prompt to click ok after doing so). But if running them when no one is logged in nothing appears to happen, Below is the script I am using,
@ECHO OFF
CLS
CD\
:WinActivation
ECHO.
ECHO.
ECHO.
ECHO -------------------------------------------------------------------
ECHO - Activate Windows...
ECHO -------------------------------------------------------------------
slmgr -ipk *product Key here*
slmgr -ato
If I run that normally nothing happens, So we believe it needs an elevated prompt to work after testing on a profile of the PC so we put in the following work around, The above script will elevate the CMD window and allow it to run. This all seems to work but only when logged in and running the task from the console.
@echo off
:: BatchGotAdmin
::-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe""%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
::--------------------------------------
::
@ECHO OFF
CLS
CD\
:WinActivation
ECHO.
ECHO.
ECHO.
ECHO -------------------------------------------------------------------
ECHO - Activate Windows...
ECHO -------------------------------------------------------------------
slmgr -ipk product Key here
slmgr -ato
::
I am trying to work out a way we can do this without any interaction on the PC. Perhaps this is not the best way, maybe I can build an executable or something that dosnt require elevation instead?
Looking for some ideas really on how to take this forward and save some chump having to login each week and set these up manually.
Thanks.