Video Screencast Help

Altiris powershell push

Created: 11 Apr 2013 | 3 comments

I am attempting to run a powershell script from altiris and having a problem

First I created a script to change the execution policy for powershell to unrestricted and verified this one works

I then created the following script.  I didnt want to make it this noisey but other iterations didnt work.

$name = Get-WmiObject Win32_ComputerSystem
$Cname = $name.name
New-PSDrive -Name Z -PSProvider FileSystem -Root \\unc\path
get-service | ft name | Out-File Z:\"$Cname".txt

 

When I run the commands directly or as a .ps1 on the server it works as expected.  When I run it from altiris i get a text file named .txt that is blank but all results in altiris come back success.  Any ideas?

Operating Systems:

Comments 3 CommentsJump to latest comment

Liam Silva's picture

Well see here is the funny part I modified the script to the following

 

 

New-PSDrive -Name Z -PSProvider FileSystem -Root uncpath
$name = $env:computername
get-service | select name | Out-File Z:\"$name".txt
 
almost everything works as expected.  The file with the computername shows up in the share just fine (no idea why it didnt want to use the wmi and I dont know why i didnt think of using $env:computername)
 
but the file is blank.  so its processing the out-file portion but not the get-service.  How is that even possible?
Liam Silva's picture

Ok so not wierd anymore.  Seems the altiris powershell is not considered an interactive session.