What i was wondering is, how to copy the next sqlite3 code into a single powershell script:
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> .once -x
sqlite> SELECT * FROM analysis;
I tried the following thing regarding the changing to powershell:
echo "SELECT * FROM analysis" echo ".once -x;" | sqlite3 C:\ProgramData\PROISER\ISASPSUS\datastore\dsfile.db
But as you can know, there is no way that two echo statements can be together in a same place. And the end result that throws Powershell is:
sqlite3 : Error: near line 2: near "echo": syntax error
En línea: 1 Carácter: 51
+ ... once -x;" | sqlite3 C:\ProgramData\PROISER\ISASPSUS\datastore\dsfile. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Error: near lin...": syntax error:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Now.
Store your SQL in a file, and pass the filename to SQLite. Essentially:
sqlite3 DB.db ".read FILENAME"
See Running a Sqlite3 Script from Command Line
Related
Trying to update ESXi 6.5 Patch using ESXiCLI within powershell. My path is pointing to a subfolder in datastore called MasterImages.
This is the the path name
/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip
Commands being executed:
$argsInstall = $esxcli.software.profile.update.createargs()
$argsInstall.depot = $patchfilepath
$esxcli.software.vib.update.Invoke($argsInstall)
Below is the error received:
Message: EsxCLI.CLIFault.summary;
InnerText: [MetadataDownloadError] Could not download from depot at
zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml, skipping
(('zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml', '', "Error extracting index.xml from
/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip: [Errno 2] No such file or directory:
'/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip'")) url =
zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml Please refer to the log file for more
details.EsxCLI.CLIFault.summary
At line:176 char:5
+ $esxcli.software.vib.update.Invoke($argsInstall)}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault
I was able to make an ESX7.0.1 update using $esxcli.software.vib.update.Invoke($argsInstall) but with 6.5 this also returns an error "not able to download from depot".
Assuming you are using the absolute path to the zipped file, please use the datastore UUID instead of the name
https://kb.vmware.com/s/article/2015834
I'm working on some Ansible playbooks that have to run on Windows Server 2008 with Powershell 3.
As part of one of these playbooks I do a win_find to get a list of files in a directory:
- name: filecheck
win_find:
paths: C:\dev\envs
register: envs
When I try to run the playbook, it runs correctly through preliminary operations (eg printing some debug variables) but then errors out when the above operation is executed:
"module_stderr": "Exception of type 'System.OutOfMemoryException' was thrown.\r\nAt line:60 char:9\r\n+ If (-not $obj.GetType)\r\n+ ~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OperationStopped: (:) [], OutOfMemoryException\r\n + FullyQualifiedErrorId : System.OutOfMemoryException\r\n \r\n\r\n",
Now I don't see a scenario where a non-recursive find on a folder with three files would be able to consume 150MB of memory, let alone the 2048 that's been allocated to shells over WinRM.
Does anyone know how I can fix this issue or try and find the root cause?
I used the tutorial and the PowerShell scripts in UefiSecureBootManualTests.zip(EnableSecureBoot.ps1 and append_LostCA_db.ps1) found here to sign an .efi file and enable SecureBoot to see if the system boots(it all worked well).
Now I'm trying to take the winload file from system32, sign it using the same scripts, and then overwrite the keys and see if SecureBoot lets me boot only with the winload I signed.
This time I am using the same scripts, except I modified Set-SecureBootUEFI command in the append_LostCA_db.ps1 deleting -AppendWrite parameter so it can overwrite.
But now I am receiving an error:
Set-SecureBootUEFI : Incorrect authentication data: 0xC0000022
At F:\SecureBoot\AllowNewCertificate\suprascriu_LostCA_db.ps1:13 char:5
+ Set-SecureBootUEFI -Name db -Time 2011-05-21T13:30:00z -ContentFilePath Lost ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (Microsoft.Secur...BootUefiCommand:SetSecureBootUefiCommand) [Set-Secu
reBootUEFI], UnauthorizedAccessException
+ FullyQualifiedErrorId : SetFWVarFailed,Microsoft.SecureBoot.Commands.SetSecureBootUefiCommand
How can I fix this?
I am using a HP desktop with Win8.1 x64
LATER EDIT: It would REALLY help if someone could give me an unsinged winload for 8.1 x64
One of the things that these signatures tell you is that the content has not been modified(that means it is still secure/valid/trustable). So that is the reason why I could not sign a file already signed(the loader used at boot and signed by Microsoft). That's why I was getting the UnauthorizedAccessException.
There is no workaround for this.
I want to be able to download patches associated with change lists in Code Collaborator using the Windows command line. These are the files you get in the web GUI if you click on External Diff. They have an extension ".collabdiff", and are in fact zipped archives containing folders for "before" and "after" of each file. I intend to use these to do a three-way merge using Subversion Merge.
My first approach was to use the Code Collaborator command line utility, e.g.
ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%
Unfortunately, it seems that this expects ASCII data only, because a lot of text appears on the screen, and there is a lot of beeping.
My next approach was to use the external link directly. To do this, I have reused a snippet of PowerShell script I found on the web:
::
:: GetCodeCollaboratorChangeList.cmd
::
:: Downloads a review change list from Code Collaborator.
::
:: %1 Code Collaborator Server
:: %2 Review Id
:: %3 Change List Id
::
#ECHO ON
SETLOCAL
SET OutputFile=%~dp0ChangeList_%2_%3.collabdiff
ECHO Creating %OutputFile%.
:: Sadly, the following line expects that ASCII text should be returned, but the URL returns binary text.
:: It beeps a little, and not much text gets redirected.
::ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%
:: So instead, we have to use our own download code.
SET URL="%1/externaldiff?reviewid=%2&changelistid=%3"
SET S=""
SET S="%S:~1,-1% $webclient = New-Object System.Net.WebClient;"
SET S="%S:~1,-1% $webclient.DownloadFile('%URL:~1,-1%','%OutputFile%');"
PowerShell.exe -ExecutionPolicy unrestricted -noprofile -command "& {%S:~1,-1%}"
EXIT /B
Sadly, I get the following error:
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (500) Internal Server Error."
At line:1 char:74
+ & { $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile <<<< ('http://server1/externaldiff?reviewid=8077&changelistid=52915','C:\Documents and Settings\Administrator\Desktop\ChangeList_8077_52915.collabdiff');}
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
When taking the URL and pasting it in the browser (rather than clicking on the link), you get the following page:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:379)
com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:351)
com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.getVersionsToDiff(ExternalDiffConfigServlet.java:373)
com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.service(ExternalDiffConfigServlet.java:140)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.smartbear.ccollab.AuthTicketFilter.doFilter(AuthTicketFilter.java:74)
com.smartbear.ccollab.CollabCleanupFilter.doFilter(CollabCleanupFilter.java:30)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20-patched logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.20-patched
I have tried modifying the code to modify QueryString and BaseAddress properties separately, and called .DownloadFile('/externaldiff, ...) but there was no change in the error.
Are there any suggestions as to how I can download these files?
Try:
ccollab admin wget 'diff?context=10&reviewid=REVIEWID'
Eg:
ccollab admin wget 'diff?context=10&reviewid=12345'
My original server was called xyz and the config was as follows:
\xyz\AppFabricConfig\ClusterConfig.xml
We renamed the server and it is now called 123, but the config is still pointing to
\xyz\AppFabricConfig\ClusterConfig.xml
And giving the following error when trying to load:
Use-CacheCluster : ErrorCode<ERRCMS0001>:SubStatus<ES0001>:Error while trying t
o load configuration: An error occurred loading a configuration file: Logon fai
lure: unknown user name or bad password.
(\\xyz\AppFabricConfig\ClusterConfig.xml)
At line:1 char:62
+ Import-Module DistributedCacheAdministration;Use-CacheCluster <<<<
+ CategoryInfo : NotSpecified: (:) [Use-CacheCluster], DataCacheE
xception
+ FullyQualifiedErrorId : ERRCMS0001,Microsoft.ApplicationServer.Caching.C
ommands.UseCacheClusterCommand
I've manually edited the following file:
C:\Windows\System32\AppFabric\DistributedCacheService.exe.config
And set: configuration/dataCacheConfig/clusterConfig connectionString="\123\AppFabricConfig\ClusterConfig.xml"
But its still trying to load from:
\xyz\AppFabricConfig\ClusterConfig.xml
Stumped - close to re-installing, but would really prefer not too!
In hind sight, best way to handle this would've been unconfigure the hosts with remove-cachehost and remove-cacheadmin, rename server and then run config wizard or run add-cachehost and add-cacheadmin.
The connection string is also present in registry, change there also: local machine\software\microsoft\appfabric\v1.0\configuration: connectionstring.
[Edit]
To remove/add the host from cluster configuration, Register-cachehost and unregister-cachehost also need to be run.