CacheExport

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

CacheExport

Post by SvanGool »

Hello,

I'm playing arround with the Cache Export for Powershell studio.
I've followed the blogs and created a cacheexport file from our on premis Exchange server (we use this server to onboard and offboard mailboxes).
When I load the cache in Powershell Studio I can see that the get-mailbox en get-remotemailbox commands are recognized by Powershell Studio (turned blue).
But as soon as I run the script (a simple get-mailbox) the output is as follows:

>> Remote Execute (GetRemoetMailbox.ps1) Script...
>> Remote Computer: SVRAPP0114
>> Platform: V5 64Bit (STA)
ERROR: The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
ERROR: included, verify that the path is correct and try again.
ERROR: + CategoryInfo : ObjectNotFound: (Get-Mailbox:String) [], CommandNotFoundException
ERROR: + FullyQualifiedErrorId : CommandNotFoundException
ERROR: + PSComputerName : SVRAPP0114
ERROR:

PowerShell Remote Host SVRAPP0114: Script completed

>> Script Ended

Normaly I run this on the server itself in a Exchange Management Shell (So not in the default Powershell).
Is this the reason? But why is the command recognized in Powershell Studio?
Any idea what I am doing wrong?

Best regards,

Sander
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: CacheExport

Post by jvierra »

You cannot run Exchange commands remotely. You need to either install the shell or use a remote connection and import the session.

https://blogs.technet.microsoft.com/samdrey/2018/04/06/how-to-load-remote-powershell-session-on-exchange-2010-2013-2016-exchange-online-o365-2/
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Re: CacheExport

Post by SvanGool »

If i'm not mistaken, a PSSession is not possible with Powershell Studio.
Or is this now possible?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: CacheExport

Post by jvierra »

Since when was that ever true? Of course you can use remote sessions.
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Re: CacheExport

Post by SvanGool »

See ticket #316025 in the premium support.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: CacheExport

Post by jvierra »

What does it say? I use remote sessions in PowerShell forms all of the time.
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Re: CacheExport

Post by SvanGool »

I was making an application for our Servicedesk so they can reset passwords etc for users.
This was the question:

I've tried doing
Enter-PSSession-computername SVRDC04
Set-Locationc:
Import-Moduleactivedirectory

This works in a powershell console, but when I put it in the startup.pss I get an error that Enter-PSSession is not implemented


This was the Answer:

Enter-PSSession cmdlet is intended for the console and is not supported by our internal hosts at this time.
If you would like to see this implemented, I recommend posting a feature request here:
https://www.sapien.com/requests
As an alternative, you could try using Invoke-Command.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: CacheExport

Post by jvierra »

You cannot use Enter-Pssession in any script. It is intended only for use intreractively.
Use "New-PsSession"
This topic is 5 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked