/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Can't get my scripts (bat and Powershell) to work.

05/26/2017 1577 views

Hello,

I'm using Kace 2000 to deploy Windows 10 on Workstations. I've created some scripts that run perfectly when i click them as an "administrator" on a workstation but they don't work when i want to use them as a post installation task in Kace.

Let's take an example.


I create this PowerShell Script to join my domain:


$user = abc@mydomain.fr

$pass = ConvertTo-SecureString "mypassword" -AsPlainText -Force

$DomainCred = New-Object System.Management.Automation.PSCredential $user, $pass

Add-Computer -DomainName mydomain.fr -Credential $DomainCred -Restart -Force


Unfortunely, in order to make it work, i need elevated privilege, so i created the following script who will run the .ps1 script:

Powershell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process Powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""c:\script\join_domain.ps1""' -Verb RunAs}"


As i said, when i click the .bat on the desktop, it works. But as soon as i want to create a post installation task, Nothing happens


I have the same problem with all my scripst like a basic one who remove  the administrator after the isntallation (i have the "french" administrateur account).


Do you guys have any idea about how to make my script to work?


Regards,


David.







0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

1
Attach your Powershell PS1 in an 'application' post task. Then Put this as the command:
powershell.exe -executionpolicy bypass -noprofile -file "script.ps1"
Answered 05/26/2017 by: Desktop Jockey
Second Degree Green Belt

All Answers

0

Thank you,

I'm going to try and i'll keep you aware.


Answered 05/26/2017 by: Kalagan
Yellow Belt

0

Hi,

Sorry for the late reply. My problem's still here. In fact, it looks like the issue is more important than i thought. I've decided to run a test with a very basic script : "mkdir c:\test\" (or Something) and it doesn't work.

All of my post installation tasks don't work and i don't even find a log file that tells me "why".

Could it be possible that the problem would be my Appliance?

I'm running Dell Kace 2000 version 3.7.120345.

Also i've noticed that Kace doesn't clean up the system after the installation. if i go to c: i can see a "KACE" folder with a lot of subfolders. In some of them i can find my bat files who will work if i click them.

Any idea?


Regards,

David.

Answered 06/07/2017 by: Kalagan
Yellow Belt

  • I too am having the same problem with my pre/post installation task.

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