/build/static/layout/Breadcrumb_cap_w.png

Powershell script launched from Kace Scripting crashes

I have a PowerShell script that copies select folders from a user's profile (Desktop, Documents, Chrome default user data folder, etc) from their computer to a new/replacement computer. The script functions perfectly running on its own but when I have it run out of Kace it fails. THe script does require input and it runs fine through that part, launching PowerShell on the computer I set it to run on in kace but as soon as it hits the point to begin the copy PowerShell either crashes (when running as local system) or throws access denied errors (when running as current user). I have tried adding credentials to the script in multiple ways with no improvement. I have run out of ideas, I really need this to be able to run out of the kace scripting so it is available to my whole Dept continuously. Any help would be greatly appreciated. 


0 Comments   [ + ] Show comments

Answers (2)

Posted by: barchetta 2 years ago
4th Degree Black Belt
0

It would be helpful if you provided your script.  I found that with kace you must start the 64bit version of powershell manually for some scripts.  This has worked for me:


set-executionpolicy bypass -force

Set-Alias Start-PowerShell64 "$env:windir\sysnative\WindowsPowerShell\v1.0\powershell.exe"

Start-PowerShell64 

(powershell script starts here)

Posted by: jbrower@sanmarcostx.gov 2 years ago
Senior White Belt
0
I appreciate your response, i figured out the solution for this a few hours, and many pulled hairs after posting the question. 

Comments:
  • What was the solution? - barchetta 2 years ago
    • added set-execcutionpolicy -scope currentuser unrestricted to the $profile and ran as current user from Kace. This has allowed it to work for me on my machines but still working on making it usable to my team on machines they have access to. I am the only one on my team with a VM and a Physical so I am trying to find a way to have it work in a VM. If you have any thoughts on that I would appreciate it - jbrower@sanmarcostx.gov 2 years ago
      • Sorry I do not.. just going to depend on your situation. I still would advise you to run the 64bit version of powershell and that should cover any script you might run. I got some very unexpected results without this. - barchetta 2 years ago

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