Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Kehama
2013-01-04T09:14:26Z
Hi,

I'm using VisualCron 6.1.3 and Exchange 2010 SP2 RU4 on Windows 2008R2 x64.

I created a script that only uses Write-Output and Write-Error (instead of Write-Host) to provide feedback, because that is the recommended way with a PowerShell task type.

However the task fails when I run the command:
Add-PSSnapin -Name 'Microsoft.Exchange.Management.PowerShell.E2010'

Error:
Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.E2010 because of the following error: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception.

I am using domain admin credentials, and have tried with "Local" and "Load Profile" button checked and unchecked (same result).
Encoding is set to UTF-8 (Windows-1252 also doesn't work).
I can reproduce this on another server.

I found a previous post about this, but it doesn't list a solution.
🤬
Sponsor
Forum information
Kehama
2013-01-04T09:20:03Z
Just to be clear, the script/snapin works fine when run manually or with the Execute task type. But it's rather frustrating to accept the limitations of Write-Output (as opposed to Write-Host) to be able to use the PowerShell task type only to find that it won't load (some) snap-ins.

Also, I just tested VC 6.1.7 and encounted the same problem.
Support
2013-01-04T11:18:02Z
Ok, I have pinged the other thread. Hopefully users answers soon. I do not remember what the result was. Here is the thread:

http://www.visualcron.co....aspx?g=posts&t=2677 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Kehama
2013-01-04T11:23:56Z
Uh, thanks, but instead of depending on another *user* to provide a possible solution - should VisualCron staff not be working on a solution ? 😲
Support
2013-01-04T11:28:36Z
I understand what you are saying but believe there are so many problems that are "outside" of VisualCron. In this specific case I know we spent hours with the user to find out the problem. Unfortunately the thread was not updated after that. There are a lot of posts about this problem on Google but no obvious solution. I know the user that had this is quite active and will respond soon.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2013-01-04T12:13:50Z
Please try this version:
http://neteject.com/down...on/VisualCron6.1.8-2.exe 

There are two things you need to do.

1. turn on extended debugging in Server settings
2. remove the line Add-Snap in from code

Try running it to see if you get same issue. And if you do please send log_serverDATE.txt to support@visualcron.com (located in log folder).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Kehama
2013-01-04T12:42:39Z
That version does seem to do something positive about the snap-in loading, as the log no longer shows that as an error.

But now the error is (and I'm sure this is not the script):
Exception in Task: Value cannot be null.
Parameter name: serverSettings. Value cannot be null.
Parameter name: serverSettings

I've sent you the log files.
bbusse
2013-01-04T14:48:47Z
I assume this script works fine when not being executed by VisualCron? I.E.... you either right-click the script and 'Run with PowerShell' or execute the PS1 file from the powershell command line?

I don't have Exchange 2010 in our environment yet (next quarter) to be able to validate this stuff yet..

Kehama
2013-01-04T14:54:04Z
It works like a charm when run from a powershell console windows, yes.
bbusse
2013-01-04T14:56:31Z
Originally Posted by: Kehama 

It works like a charm when run from a powershell console windows, yes.



Ok good. And maybe I missed it (apologies if I did but i'll ask it my own way)...

Are you referencing a PS1 file as your powershell task, or is the code just pasted into the task and its running that way? Does it work in either case?

Brian
Kehama
2013-01-04T15:01:54Z
Doesn't work as a .ps1 file or in the window provided by the VC Powershell task, I'm afraid. 😞
bbusse
2013-01-04T15:06:39Z
Originally Posted by: Kehama 

Doesn't work as a .ps1 file or in the window provided by the VC Powershell task, I'm afraid. :(



Well thats no fun at all.. ;-)


Does that one simple add-pssnapin command, all by itself, not work? Just eliminating anything else from the script as a possible cause.

Also, is this task running with a credential specified? If not, what about the account used to run the VisualCron service? Is it still SYSTEM, or did you switch it to run as another Domain ID?

Sure wish I had Exch2010 here already..., i'm used to being able to troubleshoot stuff like this better...


Kehama
2013-01-04T15:11:10Z
Doesn't work all on it's own either.

I've tried everything from local accounts to domain admin accounts, with all the options in VC account management on/off. No dice. :(

VisualCron Service is running as SYSTEM. I doubt that's it (as it will do stuff like "Import-Module ActiveDirectory" flawlessly), but I'll try that on monday.
bbusse
2013-01-04T15:14:36Z
Originally Posted by: Kehama 

Doesn't work all on it's own either.

I've tried everything from local accounts to domain admin accounts, with all the options in VC account management on/off. No dice. :(

VisualCron Service is running as SYSTEM. I doubt that's it (as it will do stuff like "Import-Module ActiveDirectory" flawlessly), but I'll try that on monday.



I'm installing the Exchange 2010 Management tools on one of our Q/test VC servers. We run the VC service as domain admin in that environment, and skip using credentials. i'll know shortly I hope.

EDIT: At least, I plan to, as long as just installing the management tools doesn't require Schema updates, etc... looks like it might as part of the prereq's, and we're not ready for that yet.
Support
2013-01-04T16:16:48Z
Thanks for the log files. I am guessing it has to do with architecture in the current context. For example, maybe your snapin is 32 bit and VisualCron run in 64 bit mode.

1. Revert to 6.1.7.
2. Run this simple powershell command in VisualCron: Get-PSSnapin -Registered

Do you see your snap-in?

Also, please make sure that you have Powershell 2.0 installed.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bbusse
2013-01-04T16:21:32Z
Exchange 2010 requires 64-bit and 2008 or higher OS. Powershell 2.0 is already there.

The Exchange 2010 tools 'should' all be 64-bit, as Exchange 2010 is not supported on 32-bit systems. I can't imagine the snappin being 32-bit.

I'd be curious if you opened the 32-bit powershell command prompt and the 64-bit powershell command prompt, and tried adding that snappin.


Support
2013-01-04T16:23:19Z
Thanks for your input Brian. I do believe we will see if it available in the VisualCron context at least by running this command:

Get-PSSnapin -Registered
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2013-01-04T16:25:49Z
Another test that would be interesting to see is the following:

1. stop the VisualCron service
2. start the VisualCronService.exe by double clicking on it
3. connect
4. deselect the Credential
5. run the Task

This text will show if there is any execution difference (maybe by user or system context) when executing as a service and when the Server is running in "desktop" mode.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Kehama
2013-01-07T08:30:53Z
Output of "Get-PSSnapIn -Registered" (service running as Local System):

Name : Microsoft.Exchange.Management.PowerShell.E2010
Name : Microsoft.Exchange.Management.Powershell.Support
Name : Quest.ActiveRoles.ADManagement
Name : SqlServerCmdletSnapin100
Name : SqlServerProviderSnapin100
Name : VMware.DeployAutomation
Name : VMware.ImageBuilder
Name : VMware.VimAutomation.Core
Name : VMware.VimAutomation.License


So it does see them. Just can't load it. Only the first snap-in produces that error (so the other Exchange snap-in does load correctly). As Brian points out, there are no 32-bit versions of Exchange 2010 software (and all servers involved are 64-bit).

However, if I run the VisualCronService.exe manually, it does load the snap-in successfully. It does this successfully whether or not I specify credentials in VisualCron, as long as the user is (at least) a local administrator for the server.

If I then run the VC Service under a newly-created user who is a local administrator for the server), I can also load the exchange plug-ins.

I don't understand why, but at least I've got a workaround now. Thank you for the assistance.
Support
2013-01-07T08:45:16Z
So, there is something registered for the current user. In most cases it would help using the same Credential (with load login and load profile checked). But if it is not helping then the problem is deeper ans specific to the desktop.

Originally Posted by: Kehama 

Output of "Get-PSSnapIn -Registered" (service running as Local System):

Name : Microsoft.Exchange.Management.PowerShell.E2010
Name : Microsoft.Exchange.Management.Powershell.Support
Name : Quest.ActiveRoles.ADManagement
Name : SqlServerCmdletSnapin100
Name : SqlServerProviderSnapin100
Name : VMware.DeployAutomation
Name : VMware.ImageBuilder
Name : VMware.VimAutomation.Core
Name : VMware.VimAutomation.License


So it does see them. Just can't load it. Only the first snap-in produces that error (so the other Exchange snap-in does load correctly). As Brian points out, there are no 32-bit versions of Exchange 2010 software (and all servers involved are 64-bit).

However, if I run the VisualCronService.exe manually, it does load the snap-in successfully. It does this successfully whether or not I specify credentials in VisualCron, as long as the user is (at least) a local administrator for the server.

If I then run the VC Service under a newly-created user who is a local administrator for the server), I can also load the exchange plug-ins.

I don't understand why, but at least I've got a workaround now. Thank you for the assistance.




Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top