Jump to content

Recommended Posts

  • 2 weeks later...
Posted
I tried to create the XML file using Ben O'Sullivan's XML generator, and that crashed my image with error "Windows could not parse or process unattend answer file c:\windows\panther\unattend.xml for pass specialize. The answer file is invalid. My IT director shot down any thought of using a third party tool such as mysysprep since it is not being authorized by Microsoft. Any suggestions?
  • 1 month later...
Posted
How can i delete the autojoindomain.vbs after its ran?

I dont want it left on the computer since it contains password

 

You should be able to just add:

 

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing

 

at the end. So it'll delete itself, might want to test it, but should work.

 

Steve

Posted
The lines you said work perfect Steve, thanks.

Problem now is i'm getting error 0 and not joining the domain like others have said, so it's not working ^^

 

Did it work before you added those lines? Or wasn't it working before?

 

It could be as simple as a command you're trying to do before the delete takes a while to complete, and you're deleting the script before it finishes.

 

Aka could put a huge delay in the delete.

 

Steve

Posted

I've took this script from another site and it seems to work, but it doesnt prompt for a computer name or automaticaly restart.

Do any of you clever script people know if its possible to add the above to this script

 

Const JOIN_DOMAIN = 1

Const ACCT_CREATE = 2

Const ACCT_DELETE = 4

Const WIN9X_UPGRADE = 16

Const DOMAIN_JOIN_IF_JOINED = 32

Const JOIN_UNSECURE = 64

Const MACHINE_PASSWORD_PASSED = 128

Const DEFERRED_SPN_SET = 256

Const INSTALL_INVOCATION = 262144

 

strDomain = "FABRIKAM"

strPassword = "ls4k5ywA"

strUser = "shenalan"

 

Set objNetwork = CreateObject("WScript.Network")

strComputer = objNetwork.ComputerName

 

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _

strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _

strComputer & "'")

 

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _

strPassword, strDomain & "\" & strUser, NULL, _

JOIN_DOMAIN + ACCT_CREATE)

 

Posted
I've took this script from another site and it seems to work, but it doesnt prompt for a computer name or automaticaly restart.

Do any of you clever script people know if its possible to add the above to this script

 

If you actually mean prompting for pc name:

 

strComputer = UserInput( "Choose a pc name:" )

 

Instead of:

 

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

 

But isn't this supposed to be an unattended file? :p

 

To do a restart you can do it like this:

 

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next

 

Think that should do it!

 

If you want the restart a bit shorter, you can use:

 

Set shellCommand= WScript.CreateObject("WScript.Shell")
shellCommand.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0"

 

Only issue is things start occuring like if people don't have the shutdown.exe in that place. But if its your own domain just rename where it is.

 

Steve

  • Thanks 1
Posted

We use a PowerShell script

 

We put a SetupComplete.cmd file in the C:\Windows\Setup\Scripts folder which then runs import.ps1 from the c:\windows\system32\sysprep\ folder the cmd also deletes the file as you don't want to leave any sensitive usernames or passwords on the C: drive jus in case.

 

The script of the import.ps1 You need to change the parts in red to suit your environment.

 

$User = "domain\user"

$Pass = ConvertTo-SecureString "Password" -AsPlainText -Force

$Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pass

add-computer -domainname domainname.local -credential $Credentials

 

If you remove the ComputerName part the xml will wait for computer name as it sets up

  • Thanks 1
Posted (edited)

Thanks. I will give both a in the morning back at work.

It is suppose to be unattended... everything but the computer name that is. I want that to prompt me before joining the domain.

 

EDIT

 

I just tried the line you suggestioned Steve

 

strComputer = UserInput( "Choose a pc name:" )

 

For me it gives an error saying 'type mismatch: "user input"

Edited by ihaveaproblem
Posted
Thanks. I will give both a in the morning back at work.

It is suppose to be unattended... everything but the computer name that is. I want that to prompt me before joining the domain.

 

EDIT

 

I just tried the line you suggestioned Steve

 

 

 

For me it gives an error saying 'type mismatch: "user input"

 

Oops should be inputbox :D

 

My bad,

Steve

  • Thanks 1
Posted

Sorry to be a pain.

Both those shutdowns dont seem to work either? I've tried both and copied the text to the end of the script an on the second one shutdown.exe is in the same location it's pointing at.

Am i doing something wrong?

Also I plan to copy the delete command at the end as well to delete the script once ran.

Posted
Sorry to be a pain.

Both those shutdowns dont seem to work either? I've tried both and copied the text to the end of the script an on the second one shutdown.exe is in the same location it's pointing at.

Am i doing something wrong?

Also I plan to copy the delete command at the end as well to delete the script once ran.

 

Well just ran:

 

Set shellCommand= WScript.CreateObject("WScript.Shell")
shellCommand.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0"

 

And it works fine. So I'm guessing either a typo, or you don't have access on the account you're running to do the command/exe? :p

 

You sure you copied it right, and have access to run it? Where are you trying to run the script from? Also are you currently on XP doing it? Or actually on Win7? Just might be fussy and want /r /t instead of -r -t

 

Steve

Posted

Is there any particular reason why you need the shutdown command?

 

Are you just using ghost or WDS/SCCM method to deploy images?

 

With the way we do sysprep (ghost), something we have found is you need to create a computer account for the machine prior to the machine running the setup part of the rebuild after image but apart from that it seem quite a straight forward task to perform once done a few times.

 

Cheers,

David

Posted

Thanks. Think i've got this sorted.

I couldnt get the shutdown script to work... i really dont know why.

 

In the end i set my answer file to prompt for a computer name, then the SetComplete.cmd ran the join domain script and also in the setupcompete is the command to do a restart after 1 minute.

Works good:) and exactly what I wanted.

  • 4 months later...
Posted

i am trying to capture a reference windows 7 32bit pro image.

 

I tried the mysysprep solution, however after capturing the image using imagex and then rebooting the machine i was prompted for a machine name but then recieved the following message

"Windows could not complete the installation. To install windows on this computer restart the installation".

i found this thread and tried the suggestions there but no joy.

Windows could not complete the installation.

Posted

I've never seen this and I've done lots of deployments recently. For people that see this message, could you confirm are you using an OEM, Retail or VLK license?

 

If you're using an existing OEM machine with Windows 7 OEM already installed, is it a Dell, HP or Toshiba for example?

 

What system model are you creating the image on?

 

What version of Windows 7 are you using? Home Premium, Professional, Ultimate?

 

Are you running x86 or x64 Windows 7?

 

Are you running Windows 7 with SP1?

Posted (edited)
Along with Micheal! Initially had similar issues sure I downloaded a hotfix to apply before sysprep, and it was with a non-sp1 version, I'll check in morning. Edited by Davit2005
  • 3 weeks later...
Posted
i am trying to capture a reference windows 7 32bit pro image.

 

I tried the mysysprep solution, however after capturing the image using imagex and then rebooting the machine i was prompted for a machine name but then recieved the following message

"Windows could not complete the installation. To install windows on this computer restart the installation".

i found this thread and tried the suggestions there but no joy.

Windows could not complete the installation.

 

resolved! i actually did an imagex capture of the reference machine as a backup just in case. As i did not sysprep the machine before i captured an image, this must have screwed it up. Many thanks Micheal for your mysysprep guide, worked a treat. I am baffled as to why the domain joining element of the standard sysprep tool does not work.

Anyway mass cloning in progress at the moment.

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



×
×
  • Create New...