So I am making a DB with EF 5 Code first, I have checked some guides and found some "important"/useful commands like: "Update-Database -Force -Verbose". However I know there must be more commands like these, something like: "Purge-Database", but no success in finding them. So my question is, where can I find all the availible commands and flags(for example: -Force, -Verbose etc) for EF 5.
I tried google but no luck, since query "EF 5 Console" etc has console and it gives result about console applications, which I don t want ofc.
Just use:
get-help EntityFramework
to get list of supported commands and:
get-help Update-Database
to get help for a queried command. Help for each command can give you information about extended help by for example using:
get-help Update-Database -detailed
You will probably be disappointed because there are only four commands provided by EF.
Related
I'm looking to for way to get an entire Power Plateform list of solutions. The aim is to export all the solutions with their properties (i.e. Name, id, date of creation, etc).
As you know, solutions can contains, Power Apps application, Power Automate flows, environment variables and so on.
I already know that Power Apps applications (canvas apps) can be retreived by using this command line:
Get-AdminPowerApp
And Flows can be retreived by using this one:
Get-AdminFlow -EnvironmentName "env"
We can found command line to get environements, connections, connectors, etc.
Is there a command line that look like the following one ?
Get-AdminPowerAppsSolution -Environment "env"
Thank you all.
To be able to get solutions with PowerShell an additional PowerShell module is required and can be install by typing the following command-line:
Install-Module Microsoft.Xrm.Data.Powershell
Once the module is installed, a connection to crm online is required :
Connect-CrmOnlineDiscovery -InteractiveMode
The InteractiveMode option prompt a modal to allow the user to enter his credentals. Connection can also be acheived by creating credental manually and then pass it as a parameter:
$creds = Get-Credential
Connect-CrmOnlineDiscovery -Credential $creds
Which prompt a login window as well, but once the credental is set, it can be reused for further calls.
And finally, a lasts commands as follow :
$records = Get-CrmRecords -EntityLogicalName solution
$records.crmRecords
The crmRecords attributes contains all the solution for the selected environment with the following properties :
ReturnProperty_EntityName
solutionid
solutionid_Property
ReturnProperty_Id
EntityReference
original
logicalname
Finding all apps across all environments to which you have admin access can be done with the following command:
Get-AdminPowerApp
More information about this command can be found on Microsoft docs here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/get-adminpowerapp?view=pa-ps-latest
You can get PowerApps Solutions by installing the PowerApps CLI.
Look at the Solution export command.
Example:
pac solution export --path c:\Users\Documents\Solution.zip --name SampleComponentSolution --managed true --targetversion 10.0.03 --include general
I ran the command
update-database -script -SourceMigration: $InitialDatabase -TargertMigration "<migration name>".
The console reported
"Applying explicit migration: <migration name>
Unfortunately, I don't know where the script(s) have been saved.
I imagined these script(s) would be separate to those you already see in the Solutions Explorer.
Many thanks.
I am working with Configuration Baselines. I would like to start from "Get-CMBaseline -Name MyBaselineName" and work my way to the name of the machines. I am try to figure out how to get the machines names that are "Compliant", "Error", and "Non-Compliant". I see the names of the machines in "Deployment Status" but I need them via PowerShell.
There are many things that are possible via the built in cmdlets but some just are not (yet?). However it is almost always possible to get the same behavior the console has with wmi (because the console uses wmi itself)
To find out how it is good to know that there is a log file "SMSProv.log" that tells you what the console does for every dialog you open. It is located on the site server wherever you installed the ConfigMgr in a sub-folder Logs (so default would be %Program Files%\Microsoft Configuration Manager\Logs).
So if you use that when checking the deployment status of a baseline you will notice that it basically translates to 3 commands (All in the namespace
Root\SMS\site_<SiteCode>
on your siteserver):
SELECT * FROM SMS_DCMDeploymentCompliantAssetDetails WHERE AssignmentID=<AssignmentID>
SELECT * FROM SMS_DCMDeploymentNonCompliantAssetDetails WHERE AssignmentID=<AssignmentID>
SELECT * FROM SMS_DCMDeploymentErrorAssetDetails WHERE AssignmentID=<AssignmentID>
where AssignemtID is the ID you would get e.g. from
(Get-CMBaselineDeployment -Name "<Your Baslines Name>").AssignmentID
A little exception would be that the console filters the error further by error type but to me it seems like this is maybe not even what you want and you could easily do it in Powershell later if you need to.
The SQL command is also available in most cases in the SMSProv.log, and in some cases it leads to a faster execution. However in this one probably not really and it is a lot more complex most of the time.
I am working with Installshield 2014 and 2011. I'm using major upgrades and automated build scripts to handle the build. InstallShield is the stand alone build ver. for both.
Now everything worked fine with Installshield 2011 on windows 2003 servers. I could use the automation interface to open a project, change the product code (for the major upgrade) then save it right before building the installer.
The code for such is in a vbs file as such:
Dim oISM, oGUID
Set oGUID = CreateObject("InstallShield.GUID")
Set oISM = CreateObject("IswiAuto17.ISWiProject")
oISM.OpenProject strInstallShieldProjectFile
oISM.ProductCode = "{" & oGUID.CreateGUID( ) & "}"
oISM.SaveProject : oISM.CloseProject : set oISM = Nothing
Now we've upgraded to windows 2012 servers and InstallShield 2014. I've double checked and according to InstallShield the only change needed is the ver number (17 changes to 21).
But now nothing works. If I take the code out and put it in it's own vbs file for testing and run it, I get this:
ActiveX component can't create object: 'InstallShield.GUID'
Looking on google I see that's from running in 64 bit mode.... but I'm not. I'm running a cmd prompt in 32 bit mode.
http://helpnet.flexerasoftware.com/installshield18helplib/AutomationInterface64Bit.htm
I tried calling the script with:
%WINDIR%\SYSWOW64\cmd.exe /c cscript
as suggested here:
How do I run a VBScript in 32-bit mode on a 64-bit machine?
and other places. This did not work as I got the same error.
I tried removing that line as I'm sure I can create a guid another way, and reran it.
Then I got this when it tries to create the project:
Unknown runtime error: 'CreateObject'
Once again google came up and I checked:
https://community.flexerasoftware.com/showthread.php?189788-Automation-error
and couple others. I tried ensuring the dll was registered using the regsvr32 and it said it was successful. But after rerunning, it gave the same error.
I tried directly coping the command from the InstallShield documentation to ensure no spelling mistakes but again same error.
I even tried switching the case of the "sw" as mentioned here:
Installshield Automation is failing while running vbscript with error unable to create object
Again though, same error.
I also tried switching to powershell as powershell is much easier to debug and read.
The powershell code is simple and is as follows:
$oIsm = new-object -comobject IswiAuto21.ISWiProject
$oISM.OpenProject("$file")
$oISM.ProductCode = "{" + [guid]::NewGuid() + "}"
$oISM.SaveProject(); $oISM.CloseProject(); $oISM = $null
But this also does not work despite these saying it should:
https://community.flexerasoftware.com/showthread.php?190769-Automation-using-Powershell
http://blogs.flexerasoftware.com/installtalk/2011/01/getting-started-with-installshield-automation-and-powershell.html
When I use the 32 bit powershell I get this error:
new-object : Creating an instance of the COM component with CLSID {78D393F9-76E3-438C-9CAB-6664EF5FE1F2} from the IClassFactory failed due to the following error:
800a801d Exception from HRESULT: 0x800A801D.
If I run solely the vbs without a cmd prompt I also see the error of 800A801D in a pop up box.
How can I fix this? I'd like to use powershell but a vbs fix would help as well at this point. I have tried everything I can think of and google says I'm doing it correctly (32 bit powershell/cmd, registering the dll, creating the object, etc).
Did you install the automation interface? Typically it's an optional feature that's set to absent when you install InstallShield.
Typically the HRESULT should tell you what's wrong, or be so generic that it doesn't help. In this case, it's a bit of an enigma as I haven't found its definition anywhere. The leading 0x800A... indicates FACILITY_CONTROL and the trailing ...801d happens to match the tail of TYPE_E_LIBNOTREGISTERED (0x8002801D), but I don't know whether that's meaningful. Unfortunately FACILITY_CONTROL is defined by the control that issues the error, and that's not clear here.
Let's try to figure out what's wrong. My bet is on COM registration. If you want, you can skip to a likely fix by running regsvr32 C:\...\System\ISWiAutomation21.dll.
So let's follow what CreateObject("IswiAuto21.ISWiProject") will do. First it has to look up the ProgID:
C:\>reg query HKCR\ISWiAuto21.ISWiProject\Clsid
HKEY_CLASSES_ROOT\ISWiAuto21.ISWiProject\Clsid
(Default) REG_SZ {78D393F9-76E3-438C-9CAB-6664EF5FE1F2}
Then it has to look up the CLSID, and in this case, its InprocServer32 key:
C:\>reg query HKCR\Clsid\{78D393F9-76E3-438C-9CAB-6664EF5FE1F2}\InprocServer32
HKEY_CLASSES_ROOT\Clsid\{78D393F9-76E3-438C-9CAB-6664EF5FE1F2}\InprocServer32
(Default) REG_SZ C:\...\ISWiAutomation21.dll
ThreadingModel REG_SZ Apartment
If either of these are missing, it will be unable to find the COM server. In addition, the TypeLib subkey and the Type Library it references are both important:
C:\>reg query HKCR\Clsid\{78D393F9-76E3-438C-9CAB-6664EF5FE1F2}\Typelib
HKEY_CLASSES_ROOT\Clsid\{78D393F9-76E3-438C-9CAB-6664EF5FE1F2}\Typelib
(Default) REG_SZ {92278CC1-987E-4A01-940C-47DCADF27496}
C:\>reg query HKCR\Typelib\{92278CC1-987E-4A01-940C-47DCADF27496}\1.1\0\win32
HKEY_CLASSES_ROOT\Typelib\{92278CC1-987E-4A01-940C-47DCADF27496}\1.1\0\win32
(Default) REG_SZ C:\...\ISWiAutomation21.dll
If any of this information is missing, it will have to be repaired. The COM Server itself may need to probe several additional IDs at this point, so there's a chance that even if this subset is okay, there are others that are missing or corrupted. Self-registering the COM server should fix this. So should running the installation's repair.
Note that all of these queries were done using the 32-bit command C:\Windows\SysWow64\reg.exe, or you can peruse the registry visually with C:\Windows\SysWow64\regedit.exe.
PowerShell 4.0
I read the Getting Started with PowerShell book. I try author's code but I get the other result... The screen of the book page (with my comment):
Read my comment on the screen, please. I get such results:
Why I get other results?
I have seen this same issue on several machines. Update-Help appears to execute successfully when run from a normal PowerShell window, but does not actually update many of the help files.
The solution is to run Update-Help from an elevated PowerShell window (Run as Administrator). Once this completes you should have all of the expected help files.
You may also have to specify the -UICulture parameter since Update-Help may not be utilizing your localization settings as seen in this post.
You can use this command to update help for your language:
Update-Help -UICulture (Get-Culture).Name
I found the reason of my problem...
I had launched Updated-Help with admin rights, of course, but I didn't restart the PowerShell session and got that unexpected result. Later I restarted PowerShell and saw that all works fine after restarting.
I didn't think that application restarting can be necessary at this case.