VMware Cloud Community
RobMokkink
Expert
Expert

Possible bug scheduled tasks Vitoolkit 1.5

Yesterday i downloaded the vitoolkit 1.5, tested all my script, everything worked.

However, i am testing running powershell scripts scheduled and it looks like intergrated authentication isn't working anymore??

Who has the same problems as i do, or is it a mistake from my side??

0 Kudos
27 Replies
LucD
Leadership
Leadership

Rob, I upgraded the host, where we run the scheduled tasks, this morning.

No apparent problem with the scheduled tasks.

You are using the Windows Scheduled Tasks I suppose ?

Did you specify an account on the scheduled account ? That has the required permissions in VI ?

What PowerShell version are you using ? I have PS v1 on that host.

I start my scheduled tasks as follows:

C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" <full-path-to-PS-script>


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

I am doing exactly the same thing. I don't specify the PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1", because i use the add-pssnapin.

I will reboot the server, i haven't rebooted the server yet.

0 Kudos
LucD
Leadership
Leadership

Fyi: our server wasn't rebooted after the VITK upgrade.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

I rebooted the server. Still the same issues. The account has the proper rights etc. No errors in the task scheduler log.

0 Kudos
LucD
Leadership
Leadership

Can you perhaps try running the script on that server while logged on with the same account you defined in teh scheduled task.

Open a Command Prompt and run the command from the scheduled task.

Don't forget to first position yourself in the working directory you defined in the scheduled task.

Does that make you any wiser why it fails ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

I used a runas and then everything works?

Now i am confused.

0 Kudos
LucD
Leadership
Leadership

I don't think that runas gives the complete process environment for the account you specify.

I think you should try it with the actual account.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

I just tested a test powershell script and that one works.

I will try your method.

0 Kudos
RobMokkink
Expert
Expert

Still no joy. The -psconfile also didn't work.

Strange problem.

0 Kudos
LucD
Leadership
Leadership

No error messages, no "access denied" or something similar ?

You did run the command from a command prompt ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

No errors what so ever. Strange problem.

0 Kudos
LucD
Leadership
Leadership

If you could eventually send me one of the scripts, I could try it on my test server.

I'll PM you.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RobMokkink
Expert
Expert

Luc thanks,

I restarted task scheduler and now i get errors creating new tasks: 0x80070005: Access is Denied

I will investigate further.

0 Kudos
RobMokkink
Expert
Expert

Okay i found the person responsable for editing the policies (he now master the skill to fly without wings)

The run as batchjob and run as a service settings where changed, on the same day when i installed vitoolkit 1.5 in the lab.

All my scripts still work with the vitoolkit 1.5

0 Kudos
CITITECHS
Contributor
Contributor

Ok am also having the same issue. Prior to upgrading to 1.5 my scheduled task worked fine.

Now the only way to get them to work is if I put the password in the script. Which I dont want to do.

I checked my local security policy, like RobMokkink suggested but my local security policy shows the settings are fine. Did something change in the toolkit in regards to authenication.

0 Kudos
RobMokkink
Expert
Expert

I also experienced the same problem again.(forgot to update this thread)

I fixed the policies which were broken like discussed previously, but the problem still remained. I uninstalled vitoolkit 1.5 and installed the previous version and the scheduled tasks worked again.

Running the same scripts from the powershell worked oke.

Can the problem be how we define the powershell scripts in the scheduled task?

I use:

C:\Windows\system32\windowspowershell\powershell.exe -command &lt;path to script\&lt;scriptname&gt;.ps1

I my scripts i have the following lines to laod the vitoolkit:

#ADD VMWARE PSSNAPIN

Add-PSSnapin -Name "VMware.VimAutomation.Core"

#FORCE TO LOAD VMWARE POWERSHELL PLUGIN

http://Reflection.Assembly::LoadWithPartialName("vmware.vim")

Who has the answer?

0 Kudos
LucD
Leadership
Leadership

Rob, it's probably a typo but the Run command should be:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe  <path to script\<scriptname>.ps1

and you can drop the -command parameter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

RobMokkink
Expert
Expert

Luc,

Indeed it was a typo. I tried the task without -command, but no luck.

0 Kudos
LucD
Leadership
Leadership

Rob, a debugging tip.

Logon with the same account that you specified in the Scheduled Task's Run as field.

When you then Run the scheduled task a Window will open where you can see all the messages the script generates.

At my site all scheduled tasks run OK with VITK 1.5.

Also the script that you send me last week.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos