Jump to content

Recommended Posts

Posted

I tried to put some scripts in FirstLogonCommands that is used after autologon with built-in administrator local account but nothing happends with this codeline;

powershell.exe add-computer -domain domain01 -cred domain01\administrator

Any ideas?

I want the credentials prompt to pop up so I can enter and reboot the computer.


Posted (edited)

Try something like this.

$cred = Get-Credential

powershell.exe add-computer -domain domain01 -cred $cred

Edited by MrJinje
Posted

Try something like this.

$cred = Get-Credential

powershell.exe add-computer -domain domain01 -cred $cred

ok, what does the first line do?

Posted (edited)

It is just a variable. They can be useful if you are doing this from a ps1 file, but obviously not from a first login perspective, that is my fault.

Here is a single line version, added benefit it seems to pre-populate the username field.

powershell.exe add-computer -domain domain01 -cred domain01\Administrator Get-Credential

Edited by MrJinje
Posted (edited)

It is just a variable. They can be useful if you are doing this from a ps1 file, but obviously not from a first login perspective, that is my fault.

Here is a single line version, added benefit it seems to pre-populate the username field.

powershell.exe add-computer -domain domain01 -cred domain01\Administrator Get-Credential

Nothing happends. Can't find anything related in setupact.log either.

I'll try with another command and see if it uses the FirstLogonCommand...

Edited by zeezam
Posted

what happens when you run the command on the machine manually. Is this the command failing or is the problem on the domain side.

When you run it by hand, try adding the -passthru -verbose to the end to see why it fails.

powershell.exe add-computer -domain domain01 -cred domain01\Administrator Get-Credential -passthru -verbose

Posted (edited)

what happens when you run the command on the machine manually. Is this the command failing or is the problem on the domain side.

When you run it by hand, try adding the -passthru -verbose to the end to see why it fails.

powershell.exe add-computer -domain domain01 -cred domain01\Administrator Get-Credential -passthru -verbose

The Credential prompt appear, then the cmd windows close and nothing happends.

I don't reach to see the error message in the cmd window...

With this line it's working manually; powershell.exe add-computer -domain domain01 -cred domain01\Administrator

I start to wondering if the command ever is run on the FirstLogonCommands.

I have it under oobeSystem in the xml file and it's unattend for the image. The image is uploaded to WDS after I ran sysprep /oobe /generalize /shutdown /unattend:"xml file".

Edited by zeezam

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...