Get-MailboxDatabase -status throws DataValidationException - powershell

When calling
Get-MailboxDatabase -Status
we get the following Exception in one environment:
You must provide a value for this property. Property Name: HostServer
+ CategoryInfo : NotSpecified: (0:Int32) [Get-MailboxDatabase], DataValidationException
+ FullyQualifiedErrorId : 1401E8AF,Microsoft.Exchange.Management.SystemConfigurationTasks.GetMailboxDatabase
+ PSComputerName : XXXXXXXXX
We tried to execute the command while connected to a server having (only) the hub transport role and on a server having the mailbox role. Both throw the same error. When we omit the -Status parameter, we get the list of all databases as expected (but without the required status information).
Since the command fails on 2 different servers of the same Organization while it is working in all other organizations, I suspect the problem is originated in AD. Any idea what could cause the issue?

Related

PowerShell error: Exception calling "FindOne" with "0" argument(s): "The user name or password is incorrect. "

There is a Windows Server VM in my department that hosts some of our Web Applications. We want one of this Web Applications to get, automatically, the user department based on his NT-USER. To do so, we imagine the following path:
User enters in the Website. His NT-User is automatically taken
by IIS Whindows Authentication;
We Powershell (using an Active
Directory API) using the NT-User as a parameter;
We finally get
the user name and department.
This API works fine in my personal computer, but not in the Server. I am executing a Powershell script like this:
$helpstring = find-user 'fie7ca' | select displayname, name, st, l, distinguishedname
$helpstring;
In my personal computer:
It works fine.
But then (in the Server), I receive the following error:
Exception calling "FindOne" with "0" argument(s): "The user name or password is incorrect.
"
At C:\Users\RBAdmin_App2\Documents\WindowsPowerShell\Modules\BC-Tools\User-Functions.psm1:496 char:11
+ $user = $searcher.FindOne()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DirectoryServicesCOMException
I am imagine that I need a Active Directory feature, use LDAP or something that I do not know.
This problem was regarding the company proxy.

ADSI commands causing Access Denied errors

I'm attempting to set the description attribute in ADSI via PowerShell, but keep getting "access denied". It's executing from a non-privileged user, but the user does have Write All Properties permissions over this object. With those permissions, I don't see why I would need to be a DA to write to that attribute.
Example shown here:
$Computer = [ADSI]"LDAP://cn=TESTER,cn=Computers,dc=lab,dc=local"
$Computer.Put("description", "test")
$Computer.setinfo()
$Computer.setinfo() Exception calling "setinfo" with "0" argument(s): "Access is denied. " At line:1 char:1 + $Computer.setinfo() + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI`
When I don't include the parenthesis (eg: $Computer.setinfo), it sets the attribute locally but never pushes it to AD. Yes i'm running in an elevated PS session.
As #Lee_Dailey mentioned, you'd better include the error message in the original post.
About the issue, are you running the script in an elevated prompt? It does not matter whether user has permissions on AD object or not if the resource requires running in elevated prompt. You should explicitly run as administrator if it needs. Can you please check again to see if that is the case here?

Why am I getting a "Value does not fall within the expected range" error when trying to set the credentials for an IIS Application Pool?

I have an application pool called "test" that was previously created. I followed the instructions in this article here to have the pool running under an account:
https://learn.microsoft.com/en-us/iis/manage/powershell/powershell-snap-in-making-simple-configuration-changes-to-web-sites-and-application-pools
Here is my code:
$pool = Get-Item IIS:\AppPools\test
$pool.ProcessModel.UserName = [string]'domain\testname'
$pool.ProcessModel.Password = [string]'testpassword'
$pool.processModel.identityType = 3
$pool | Set-Item
However, this gives me an error:
Set-Item : Value does not fall within the expected range.
At line:5 char:9
+ $pool | Set-Item
+ ~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Item], ArgumentException
+ FullyQualifiedErrorId : path,Microsoft.PowerShell.Commands.SetItemCommand
Is there something I'm doing wrong? What value am I missing?
I found the issue. It appears that when cleaning up unused Nuget packages in my project, I've accidentally deleted Ninject, which is vital for dependency injection to work. I reinstalled several Ninject components that relates to ASP.NET and I was able to run it again.
When encountering this issue, it may be useful to go through the project and check if dependency injection is implemented or even partially implemented.

Deciphering error after runnning New-AzureRmDataLakeAnalyticsCatalogCredential

I am working on reading Azure SQL data from a U-SQL script into Data Lake. I am working on creating an external data source in U-SQL. A part of this effort involves the creation of a “credential” using PowerShell. I am following this guidance:
https://learn.microsoft.com/en-us/powershell/module/azurerm.datalakeanalytics/new-azurermdatalakeanalyticscatalogcredential
But, am stuck on an error, shown below. This part of it has me especially stumped: "The resource '' does not exist.". Due to this part of the command : "-Credential (Get-Credential)", I get prompted for login name and password. After that, I get presented with the error.
Please help me decipher this situation.
Thank you!
Eric
C:\WINDOWS\system32> New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "" `
-DatabaseName "<MYDBNAME>" `
-CredentialName "<MYCREDENTIALNAME>" `
-Credential (Get-Credential) `
-Uri "http://<MYSERVERNAME>.database.windows.net:1433"
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
WARNING: The output type defined for this cmdlet is incorrect and will be updated to reflect what is actually returned
(and defined in the help) in a future release.
New-AzureRmDataLakeAnalyticsCatalogCredential : The resource '' does not exist. Trace:
c3e04b2a-2690-4c5e-b61c-58a5ded93c6b Time: 2017-05-10T09:09:07.8971058-07:00
At line:1 char:1
+ New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "bladlalog ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmData...talogCredential], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeAnalytics.NewAzureDataLakeAnalyticsCatalogCredential
Solved by using a new ADL database name, that I created, and not the source Azure SQL database. I got the "az dla catalog credential create" to run cleanly. .... The online documentation I initially found was not clear for indicating the expected database name was an ADL database, and not the source Azure SQL database.

Exception exporting Azure ResourceGroup template

I'm trying to export an Azure ResourceGroup to a template-file using the following cmdlet (Windows 10 x64, module-version 2.0) but it throws an exception PS> Export-AzureRmResourceGroup -ResourceGroupName 'service-env-rg' -Path .\resourcegroup.json -ErrorAction SilentlyContinue Export-AzureRmResourceGroup : InternalServerError : Encountered internal server error. Diagnostic information: timestamp '20160809T072241Z', subscription id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', tracking id 'eed95646-d845-4852-8971-a353bab65db2', request correlation id 'eed95646-d845-4852-8971-a353bab65db2'. At line:1 char:1 + Export-AzureRmResourceGroup -ResourceGroupName 'service-e ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Export-AzureRmResourceGroup], ErrorResponseMessageException + FullyQualifiedErrorId : InternalServerError,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ExportAzureResourceGroupCmdlet
If I run it without -ErrorAction I get a secondary exception as well with the pipeline being stopped. Anyone else seen this ? I got the same error with the previous version of the cmdlet.
I wonder if this is related to the fact that it appears the 'template export' functionality in the Azure portal is not really working properly either ... see this very recent forum thread:
https://social.msdn.microsoft.com/Forums/en-US/3200b7a1-768c-4714-a474-ac02df22e729/problem-with-exporting-current-state-arm-template-for-a-resource-group?forum=windowsazuremanagement
After renaming my Microsoft-account it now works - both in Powershell and in the portal. Ie, it seems that an ARM update has introduced an authentication-change so that a login doesn't properly differentiate between accounts even though I select the type.