/build/static/layout/Breadcrumb_cap_w.png

Powershell script won`t start through K2000 ?!

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" 


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: dugullett 10 years ago
Red Belt
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.

Posted by: Swede 10 years ago
Blue Belt
0

Thx, seems to work!

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ