pccarrick Posted November 2, 2015 Report post Posted November 2, 2015 Hi I wonder if anyone can help with a very strange problem I am having with a task sequence running on SCCM 2012 R2 SP1. I have a powershell script which runs in a task sequence and gives the user an option to select a time to delay running of the task. The problem I have is that the below section of commands is returning a value of null on some machines in one of our office's. However it is running fine in other offices, if I run the script local on the machine it works fine which is really confusing. $datetime = get-date $current_time = $datetime.ToShortTimeString() $global:AlarmTime = $global:Time.Value $global:start_time = $global:AlarmTime.ToShortTimeString() $global:endtime = (new-timespan -Start ($current_time) -end ($global:start_time)).Totalminutes the problem is with the $global:endtime all other values are returning correct. I am running this in the task sequence as a run command line with the following syntax. ServiceUI.exe -process:TSProgressUI.exe C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -WindowStyle Hidden -ExecutionPolicy Bypass -noprofile ".\Updates.ps1" If I run it as a powershell script rather than a command line it won't run at all. any help or advise on this would be really appreciated. Quote Share this post Link to post Share on other sites More sharing options...