Hi!

I want to run a PS-script trough K2000 after Windows 7-installtion is done. The script will join PC to the domain. But nothing happen, script should work, have test i manually.

Script looks like this:

$domain = "company"

$password = "password" | ConvertTo-SecureString -asPlainText -Force

$username = "$company.local\admin" 

$credential = New-Object System.Management.Automation.PSCredential($username,$password)

Add-Computer -DomainName $domain -Credential $credential 

restart-computer

In K2000 looks like this:

Name:
Type: Application
Runtime Environment:  
 
 
 
Created: Ons, 4 Jun 2014 11:28:06
Modified: Ons, 4 Jun 2014 13:33:18
Version: 4
 
File: domain.ps1 
File Size:

288 B

 

command line is : powershell.exe -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "domain.ps1" 

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

I had to ZIP my .ps1 file along with a .bat file that had that command line in it. Then in your post install task upload the ZIP, and enter the name of your .bat in the command line field.

Answered 06/04/2014 by: dugullett
Red Belt

Please log in to comment
0

Thx, seems to work!

Answered 06/10/2014 by: Swede
Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share