Working with ConvertTo-Json output issues

As you are aware, we can use ConvertTo-Json cmdlet to convert an object to Json output format using PowerShell. However, there is something you need to be aware of while using conversion. By default, it does not work with very large objects (containing of multiple sub-objects) and converts them properly. This is because of the fact that the Depth parameter for ConvertTo-Json has a default value of 2. Let’s understand what this means.

For our example, we’ll create a JSON file with below details first and save it on to your local machine as new-json.json

Continue reading “Working with ConvertTo-Json output issues”

Azure Resource Group Error: A parameter cannot be found that matches parameter name ‘EnvironmentName’

Recently, if you have been trying to deploy Azure Resource Group template using Visual Studio, you might see below error:

[ERROR] Add-AzureRmAccount : A parameter cannot be found that matches parameter name 
[ERROR] 'EnvironmentName'.
[ERROR] At line:1 char:2379
[ERROR] + ... xmg' -AccountId '' -EnvironmentName 'AzureC ...
[ERROR] +                                                  ~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : InvalidArgument: (:) [Add-AzureRmAccount], Param 
[ERROR]    eterBindingException
[ERROR]     + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands. 
[ERROR]    Profile.AddAzureRMAccountCommand
[ERROR] Run Login-AzureRmAccount to login.

Continue reading “Azure Resource Group Error: A parameter cannot be found that matches parameter name ‘EnvironmentName’”

SQL Error : Index was outside the bounds of the Array (Microsoft.SqlServer.smo)

If while working on Azure SQL PaaS or even on-premise SQL database, you are stuck with this error “Index was outside the bounds of the Array. (Microsoft.SqlServer.smo)”, the most likely reason is that the version of SQL server management studio on your local machine is on the lower version that the SQL server version on the server end.

In such a scenario, you would need to upgrade the SSMS version installed on your local machine. Apparently, the reason behind the error message is that SQL couldn’t show new features in your old SSMS version. Continue reading “SQL Error : Index was outside the bounds of the Array (Microsoft.SqlServer.smo)”

Understanding default encoding and Change the same in PowerShell

This blog post is to discuss output encoding format used when data is passed from one PowerShell cmdlet or to other applications. This is a rarely understood feature unless you are trying to write some module which integrates PowerShell with another software. 

Passing output between PowerShell cmdlets

The Strings inside PowerShell are 16-bit Unicode, instances of .NET’s System.String class. So by default, when you pipe output from one cmdlet to another, it is passed as …Continue Reading

Oracle virtual box fails to work on machine where hyper-v is installed

Consider this scenario:

  1. You have hyper-v installed on a windows server/client OS and it’s working fine
  2. You install oracle virtual box or any 3rd party virtualization application on machine and it fails with below error:
VT-x/AMD-V hardware acceleration is not available on your system. Certain guests 
(e.g. OS/2 and QNX) require this feature and will fail to boot without it.

Or vice-versa. …Continue Reading

The “CompileWorkflowTask” task failed unexpectedly – Jenkins build failure

Consider this scenario:

  1. You have installed Jenkins on a windows server
  2. You are building visual studio project using msbuild plugin in Jenkins
  3. Your build keeps failing with below message:
error MSB4018: The "CompileWorkflowTask" task failed unexpectedly. 
error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the 
path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\it1lwybv.tmp'. 
error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, 
String maybeFullPath) 
error MSB4018: at System.IO.FileStream.Init(String path, FileMode mode, 
FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, 
Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)

There are two reasons this could happen …Continue Reading