Hi Allen,
After doing all of the above including the Import-PSSession $Session, how do I execute RedistributeActiveDatabases.ps1?
This is script is not on the local RES server? Heres what I tried:
- Copy script files locally and run them sequentially in this PowerShell session:
- .\RemoteExchange.ps1
Import-LocalizedData : Cannot find PowerShell data file 'RemoteExchange.strings.psd1' in directory 'D:\scripts\Exchange\en-US\' or any parent culture directories.
At D:\scripts\Exchange\RemoteExchange.ps1:4 char:1
+ Import-LocalizedData -BindingVariable RemoteExchange_LocalizedStrings -FileName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\scripts\Exch...ge.strings.psd1:String) [Import-LocalizedData], PSInvalidOperationException
+ FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData
get-itemproperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup' because it does not exist.
At D:\scripts\Exchange\RemoteExchange.ps1:46 char:18
+ $global:exbin = (get-itemproperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Se ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\...erver\v15\Setup:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
- Connect-ExchangeServer does not work. Probably needs info from RemoteExchange.ps1
- Try using UNC path to Exchange Server directories: PS ResServer > cd \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\ bin\
- PS Microsoft.PowerShell.Core\FileSystem::\\Mailserver1\c$\>.\RemoteExchange.ps1
get-itemproperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup' because it does not exist.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\ bin\\RemoteExchange.ps1:46 char:18
+ $global:exbin = (get-itemproperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Se ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\...erver\v15\Setup:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
get-itemproperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup' because it does not exist.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1:47 char:22
+ $global:exinstall = (get-itemproperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\...erver\v15\Setup:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
get-itemproperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup' because it does not exist.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1:48 char:22
+ $global:exscripts = (get-itemproperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\...erver\v15\Setup:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Users\MyAdminAccount\bin\Microsoft.Exchange.Data.dll' or one of its dependencies. The system cannot find the file specified."
At \\s-mail11\d$\Program Files\Exchange\Bin\RemoteExchange.ps1:55 char:15
+ | ForEach { [System.Reflection.Assembly]::LoadFrom((join-path $global:exbin $_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileNotFoundException
4. Even with all those errors I still tried to execute:
PS Microsoft.PowerShell.Core\FileSystem::\\Mailserver1\...c$\>. .\RedistributeActiveDatabases.ps1 -DagName D001 ShowDatabaseDistributionByServer
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.Exchange.Management.PowerShell.E2010' is not installed on this computer.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:137 char:9
+ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Excha...owerShell.E2010:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Unable to find type [Microsoft.Exchange.Data.Directory.SystemConfiguration.ReplicationType]: make sure that the assembly containing this type is loaded.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:147 char:1
+ $ReplicationTypeType = [Microsoft.Exchange.Data.Directory.SystemConfiguration.Re ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...ReplicationType:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Exchange.Management.SystemConfigurationTasks.MoveStatus]: make sure that the assembly containing this type is loaded.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:148 char:1
+ $MoveStatusType = [Microsoft.Exchange.Management.SystemConfigurationTasks.MoveSt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...asks.MoveStatus:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Exchange.Management.SystemConfigurationTasks.MountStatus]: make sure that the assembly containing this type is loaded.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:149 char:1
+ $MountStatusType = [Microsoft.Exchange.Management.SystemConfigurationTasks.Mount ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...sks.MountStatus:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Exchange.Data.Directory.SystemConfiguration.DatabaseCopyAutoActivationPolicyType]: make sure that the assembly containing this type is loaded.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:150 char:1
+ $AutoActivationType = [Microsoft.Exchange.Data.Directory.SystemConfiguration.Dat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...ationPolicyType:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Exchange.Management.SystemConfigurationTasks.CopyStatus]: make sure that the assembly containing this type is loaded.
At \\Mailserver1\C$\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:151 char:1
+ $CopyStatusType = [Microsoft.Exchange.Management.SystemConfigurationTasks.CopySt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...asks.CopyStatus:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
All of this to no avail. So what am I doing wrong?
To summarize:
- Cannot execute the command locally on the RES server even after copying them over from the Exchange Server;
- Cannot execute the scripts using the UNC path \\Mailserver1\c$\... on the Exchange Server;