MSBUILD You Must Provide a Value Expression Following the Operator

In this post, we will look at the error “You must provide a value expression following the ‘/’ operator.” You may get this when you are trying to run the command msbuild in PowerShell : “C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe” /t:restore In order to resolve this, run the command with an ampersand before it: & “C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe” /t:restore We see the command is now working.

Term is Not Recognized in PowerShell

In PowerShell, you may encounter the error “The term 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 included, verify that the path is correct and try again.” Let’s look at how to fix this. In the example below, I have a function called Add2, which adds 2 numbers: The code: $num1 = … Continue reading Term is Not Recognized in PowerShell

PowerShell Loop Through Array

In this post, we will look at how to loop through an array in PowerShell. We can define our array as: $myArray = “one”, “two”, “three” And loop through it like below: foreach ($arr in $myArray) { Write-Output $arr } Running this, we get:  

PowerShell If Statements

PowerShell If statements need to be written in a particular syntax. Let’s look at some examples below. Equals In the example below, we test for equals. Note the notations -eq: $a = 1 $b = 2 If ($a -eq $b) { Write-Output “Equal” } Else { Write-Output “Not Equal” } Greater Than In the example below, we test for equals. Note the notations -gt: $a = 1 $b = 2 … Continue reading PowerShell If Statements

Dynamics 365 PowerShell – Microsoft.Xrm.Data.Powershell

The Microsoft.Xrm.Data.Powershell module for PowerShell provides data operations such as CRUD. The module is available for download at: https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/releases/ Download the ZIP file and unblock it by right clicking. If you do not unblock it you will get errors relating to could not load file or assembly with the Microsoft.Crm.Sdk.Proxy.dll. Next extract the zip. There is one folder: With multiple files: Copy the folder to the C:\Windows\System32\WindowsPowerShell\v1.0\Modules folder: Check the PowerShell version. This module … Continue reading Dynamics 365 PowerShell – Microsoft.Xrm.Data.Powershell

Powershell Cmdlets for Dynamics CRM On-Premise

To use the cmdlets for Dynamics CRM On-Premise, do the following. Go to the server running the Full Server role for Dynamics CRM. Type in: Add-PSSnapin Microsoft.Crm.PowerShell You can now run CRM commands. Type in: Get-Help *Crm* CRM will return help information on its commands: You can then run individual commands, for example, it you want to see CRM settings, you can run a command to get a particular setting. … Continue reading Powershell Cmdlets for Dynamics CRM On-Premise

PowerShell Introduction

PowerShell is an interactive shell and a scripting language for Windows environments. It has several uses including for automation and configuration. It is also object oriented and based on the .NET Framework. To run commands, open the Windows PowerShell app: You can then run commands such as changing directory like in DOS. PowerShell also has the concept of “aliasing”, which is running a command by typing a different name. For example, there are several … Continue reading PowerShell Introduction

How to use PowerShell cmdlets for Dynamics CRM

In the Dynamics CRM SDK, there is the capability to use PowerShell to connect to CRM. To do this, in the SDK\Bin folder, there is a file called RegisterXRMTooling.ps1: Open PowerShell as an Administrator and from the file directory, run .\RegisterXRMTooling.ps1 Once complete, you should see something like below: Next run: Add-PSSnapin Microsoft.Xrm.Tooling.Connector Type: Get-Help “CRM” to see it working:  

Node Server Upgrade on Windows

Here we will go throgh the steps to upgrade your Node server. First, open PowerShell as Administrator. We will check the version of the server currently installed, with the command: node -v Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force Then run: npm install -g npm-windows-upgrade Next, run: npm-windows-upgrade Select a version: You will see: And once complete:  

Running a .NET Console App in Silent Mode

In .NET, you may need to run your console app in silent mode. To do this, create a new console app. Our app will open a webpage using IE: To run in silent mode, set the Output type in the properties of the code to Windows Application: Now, when you run the code, it will run silently. In this case, you will see a web page open.