As stated in the last thread. Am also having the same issue. Am replying so that I get alerts when post are made to this thread.
Thanks CITITECHS for the update. I will not close this thread until the problem is resolved.
As a workaround i create a encrypted password file the same way i use it in my updatelocalusers script to login as root to the individual esx hosts.
I have done some extra error handling %APPDATA%, the users profile folder is not loaded during a scheduled taks:
I too am seeing the exact same problem after upgrading to 1.5.
Okay, i got it working using the following few lines:
#FIX FOR TOOLKIT 1.5
$USER = $env:username
$APPPATH = "C:\Documents and Settings\" + $USER + "\Application Data"
#SET THE APPDATA ENVIRONMENT WHEN NEEDED
if ($env:appdata -eq $null -or $env:appdata -eq 0)
$env:appdata = $APPPATH
Can other people please test also? So i know this is a proper fix.
Rob - The Fix worked for me thanks ...
If you get a chance please share your debugging methods as how you determined that was needed.
CITITECHS good to hear it works oke.
You can debug powershell script quite easily when running as a scheduled task, add the following after the C:\Windows\system32\windowspowershell\v1.0\powershell.exe <pathtoscript\<scriptname>.ps1 2>&1 >> C:\debug.txt
I also ran the scheduled task when i was logged in as the service account , tip from LucD.
You redirect standarderror is redirected to standardout which you log into a file.
Your fix works for me on XP and W2K3.
Well done Rob.
Thanks for testing and helping me fix the problem.
Thank you Rob, that worked. I also tried logging in with my functional account and set a AppData environment variable to the proper folder and that worked also, probably not recommended.
the powershell $env:appdata is the equivalent of the commandprompt %APPDATA%, it is always set when you are logged in, but it is empty when running a scheduled task.
You can see the value when you do $env:appdata in powershell. So you don't need to set in when you are logged on.
I ended up just using:
$env:appdata = "C:\Documents and Settings\" + $USER + "\Application Data"
Works a treat! Thanks for the fix.
Oke the problem is fixed. I will set the thread to answered.
Thank you all for testing.
Awesome! Thanks for the fix Rob!!