Update WebView2 Runtime via Command-Line - command-line

I know that the "Microsoft Edge WebView2 Runtime" on my system has a vulnerability (2-Day) and that there is a new version available, that I can install.
I know that I can check for updates of Office 365 with the following command:
c:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe /update user
So, is there a way to check for updates of the "WebView2 Runtime" via Command-Line?

Related

PowerShell Module cannot be loaded when running Pester test in Visual Studio

I have created a PowerShell test script, Common.tests.ps1, using Pester against some functions in a PowerShell script, Common.ps1, in the same directory.
There is a TestInitializer.ps1 script, also in the same directory, which uses the Microsoft.Xrm.Data.PowerShell module to create and get records in a Dynamics CRM instance.
When running the PowerShell test script from Visual Studio, the test fails in the Test Explorer with a message:
CommandNotFoundException: The module 'Microsoft.Xrm.Data.PowerShell' could not be loaded. For more information, run 'Import-Module Microsoft.Xrm.Data.PowerShell'.
The same test when run from the PowerShell ISE, however, runs without issue. This would seem to be as if the module is not installed for the instance as run by Visual Studio (I confirmed this when running Get-Module -ListAvailable and seeing that the output did not include the Microsoft.Xrm.Data.PowerShell module for the Visual Studio test), though even explicit calls like Import-Module Microsoft.Xrm.Data.PowerShell -Global -Force don't seem to load the module during the script execution with Visual Studio.
Here's Common.test.ps1:
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
. $here\Common.ps1
. $here\TestInitializer.ps1
Describe "SelectionToSingleCharString" {
Context "StringTransforms" {
It "Retrieves a CRM record and uses the optionset value to retrieve a single character" {
SelectionToSingleCharString($crmRecord.new_type) | Should Be "I"
}
}
}
Snippet from TestInitializer.ps1:
# Whether or not this is uncommented does not matter
#Import-Module "$env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules\Microsoft.Xrm.Data.PowerShell\Microsoft.Xrm.Data.PowerShell.psd1" -Global -Force
#$modules = Get-Module -ListAvailable
#Write-Host $modules
# Failing here
Microsoft.Xrm.Data.PowerShell\Connect-CrmOnPremDiscovery -ServerUrl $loginServerUrl -OrganizationName $loginOrgName -Credential $cred
I may instead design the test to use Mock instead of actually attempting to create/read records, though not being able to load external modules and run in Visual Studio would be limiting.
Regarding module install directories (skip this if you are interested in the actual problem):
First you should never install modules to $PSHome\Modules (%Windir%\System32\WindowsPowerShell\v1.0\Modules). This folder is reserved for modules shipped with Windows only.
You should always install your modules used only by your user under the following path:
$Home\Documents\WindowsPowerShell\Modules
And for a system-wide installation under:
$Env:ProgramFiles\WindowsPowerShell\Modules
Further reading regarding installing modules in PowerShell can be found on MSDN.
Regarding your actual problem:
What Visual Studio Version are you using? I have Visual Studio 2017 Community edition installed and can not reproduce your error. My PowerShell is also running as a 64-bit process. Your PowerShell could be running as a 32-bit process. For the 32-bit PowerShell the module directories are different. This would explain why the module you installed isn't showing up in Visual Studio.
You can verify if your PowerShell is running in a 64-bit process with the following command:
PS> [Environment]::Is64BitProcess
True
To make your modules accessible for the 32-bit PowerShell you need to install them under the following path as well:
{$Env:ProgramFiles(x86)}\WindowsPowerShell\Modules

Windows service - System.IO.FileNotFoundException: Could not load file or assembly my.dll

I created Net 4.5 Windows service which is used my.dll. My.dll is compiled with CLR support. I created msi file using Project Setup project from Visual Studio 2013. I set vsdraCOM option for my.dll file to provide auto registering of library.
When I install and start service under development machine (with Visual studio 2013) using sc command the service starts well. But then I use msi file for installing under "clear" machine and then try to start I get an error: System.IO.FileNotFoundException: Could not load file or assembly my.dll
I tried to register dll by hand using regsvr32 my.dll but got an error: Could not load module "\mydll". Could not find path .` (the error message was translated from my native language).
I also used ProcMon to analyze what was the problem but didn't see any faults.
I tried to put dll file into System32 directory but it didn't solve the problem.
I installed redistributable package and add the following dlls in System32 directory: msvcp120d.dll, msvcr120d.dll, vccorlib120d.dll from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT\
The problem is solved

WebAdministration module not found

I have installed a WebServer 2008 R2 Core version and I'm trying to configure it to be remotely managed from another server in the domain I need to import the WebAdministration module According to the steps exposed in this article
http://www.iis.net/learn/install/installing-iis-7/install-and-configure-iis-on-server-core
using the Import-module WebAdministration it gives me the specified module 'WebAdministration' was not loaded because no valid module file was found in any module directoryAt line1 char 14. I executed the command Get-Module -ListAvailable and returned 4 module types
BestPractices, BitsTrabsfer, PSDiagnostics and ServeManager
I read the other threads about the issue none of them is consistent and proposes a good solution to that. BTW is there a way to let the server download the requested modules form microsoft repository if not found. Any consistent proposal to solve this will be appreciated
Is the IIS PowerShell Snap-In installed? If not, you can download the 32-Bit version or the 64-Bit version. After you run the MSI (using msiexec /i, since this is core), the snap-in should be registered and can be invoked via import-module or
& "$env:programfiles\IIS\PowerShellSnapin\iisConsole.psc1"
On Windows 7 I installed Web Platform Installer from
https://www.microsoft.com/web/downloads/
On the start menu search for "web" to make the app visible.
Then using Web Platform Installer ... Install IIS: Management Scripts and Tools
Make sure that the IIS is installed and configured properly

WIX installer for VSTO Word Template for Word 2013 not working correctly

I developped a VSTO based Word Template and a WIX based installer for it.
In general the installer works fine, except on Windows 8.1 with Office 2013 (32Bit).
For som unknown reason Office 2013(32Bit) is installed at "C:\Program Files" and the related registry key is pointing to it correctly.
During execution of the msi package for the Word Template, the registry key seems to be modified as shown in logfile of msiexec:
MSI (c) (18:98) [09:10:34:954]: WIN64DUALFOLDERS: 'C:\Program Files (x86)\' will substitute 17 characters in 'C:\Program Files\Microsoft Office 15\Root\Office15\WINWORD.EXE' folder path. (mask argument = 0, the folder pair's iSwapAttrib member = 0).
As a consequence Winword.exe is not found and the installer stops.
I'm using this WIX Code to check whether Word 2010 or newer is installed:
<Property Id="WORDEXEVERSION"
Secure="yes">
<RegistrySearch Id="RegSearch_WORDEXE"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe"
Type="file">
<FileSearch Name="WINWORD.EXE"
MinVersion="14.0.0.0" />
</RegistrySearch>
</Property>
<Condition Message="Word 2010 or newer is required."><![CDATA[Installed OR WORDEXEVERSION]]></Condition>
On other machines with Win 8.1 and Office 2013(32Bit) where Office is installed to "C:\Program Files (x86)" everything works fine.
Does anyone have an idea why Office 2013 could have been installed to the obviously wrong folder or how to make msiexec behave as expected?
The user might have forced the install to go there, that may be possible, or the actual system may have done an in-place upgrade to a 64-bit OS and so the stuff in Program Files will stay there.
What's the purpose of the detection? To see if Word is installed? I ask because I seem to remember that templates have their own folder somewhere and that's where you'd install your template.

System.Data.SQLite Windows x64 install fails; could not load file or assembly or dependency error

I downloaded the 64-bit Windows SQLite setup executable to install on my Windows 7 x64 machine:
sqlite-netFx40-setup-bundle-x64-2010-1.0.78.0.exe
(11.60 MiB)
and ran the setup. It failed with this error:
Could not open
HKEY_LOCAL_MACHINE\Software\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
There was no "AssemblyFoldersEx" key beneath "v4.0.30319". So I created the key there and re-ran the setup, which completed this time without error.
However, when I try to add the reference, System.Data.SQLite does not appear in the list of components on the .NET tab.
What would be the next troubleshooting step? Thanks
Since VS2010 is Win32 and not x64, you need to install the Win32 setup to get design-time support. You can still use the x64 binaries with your application, the Win32 is only needed for VS integration.
Yes, you need to install Win32 SQLite for design time support; after download and executed 32bit setup (sqlite-netFx40-setup-bundle-x86-x-x.x.x.x.exe), if you still facing the same error you can run the VS designer components 32bit installer without the option checked by following steps:
Open a Visual Studio command prompt.
Change to the "System.Data.SQLite\2010\bin" install directory.
eg: CD D:\Programs\System.Data.SQLite\2010\x86\bin\
Run the following commands:
corflags /32BIT+ /Force Installer.exe
sn -k System.Data.SQLite.snk
sn -Ra Installer.exe System.Data.SQLite.snk
Installer.exe -install true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noVs2008 true -whatIf false -confirm true
Command explaination:
corflags /32BIT+ /Force Installer.exe
Using the "corflags" tool (part of the .NET SDK), flag the "Installer.exe" tool as 32-bit only
sn -k System.Data.SQLite.snk
Generate any strong name key pair (Any key pair SNK file will work here)
sn -Ra Installer.exe System.Data.SQLite.snk
Re-sign the "Installer.exe" assembly using the above generated strong name key pair
Installer.exe -install true -installFlags All... -confirm true
Run installer with neccessary flags, but the most important is to put in '-confirm true'; as this is the needed flag for SQLite installer which prevent user execute setup by clicking the installer.exe directly in windows explorer.