sh : The term 'sh' 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.
At line:1 char:61
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+ ~~
+ CategoryInfo : ObjectNotFound: (sh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Related
I have tried on terminal:
psql -d test < .\backup_database.sql
At line:1 char:14
+ psql -d test < .\backup_database.sql
+ ~
The '<' operator is reserved for future use.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
pg_dump command worked seamlessly on terminal.
So where do i run psql command.
Tried on dbshell-Not working, Manually adding on pgadmin 4 gives pg_restore: error: input file appears to be a text format dump. Please use psql.
Don't use redirection on Windows, use the -f parameter to pass the file to be run:
psql -d test -f backup_database.sql
I am trying to convert vmdk formate image to hda.qcow2 formate through this command:
qemu-img convert -f vmdk -O qcow2 server\server2016.vmdk hda.qcow2
but it show the following error
qemu-img : The term 'qemu-img' 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.
At line:1 char:1
+ qemu-img convert -f vmdk -O qcow2 server2016.vmdk server2016.qcow2
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (qemu-img:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I do this two-stage conversion (vmdk->raw->qcow2) in bash using qemu-img QEMU utility (in Debian qemu-utils package)
echo "Converting multiple VMDK files in $PWD into QCOW2..."
rm -f tmpImage.raw
for i in *.vmdk; do
echo "Converting $i ..."
qemu-img convert -f vmdk "$i" -O raw "$i.raw"
cat "$i".raw >> tmpImage.raw
done
echo "Creating finalImage.qcow2..."
qemu-img convert tmpImage.raw finalImage.qcow2
rm tmpImage.raw
The only real question is whether we want to append the unsequenced "$i.vmdk" file to the end of its final raw image before converting, but it seems to work best this way.
I am getting started with Apache isis (I have Windows 10) and following their tutorial (https://isis.apache.org/guides/ugfun/ugfun.html#_ugfun_getting-started_helloworld-archetype)
I installed Java and Maven, added them to the path and then I created a folder inside which when I run command mvn -v I see folling output:
E:\Apache isis\test_project>mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: D:\Development softwares\apache-maven-3.5.3-bin\apache-maven-3.5.3\bin\..
Java version: 9.0.4, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre-9.0.4
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
When I run the command specified in their docs to generate app:
mvn archetype:generate \
-D archetypeGroupId=org.apache.isis.archetype \
-D archetypeArtifactId=helloworld-archetype \
-D archetypeVersion=1.16.2 \
-D groupId=com.mycompany \
-D artifactId=myapp \
-D version=1.0-SNAPSHOT \
-B
I get following error:
PS C:\Users\Nitish> cd .\Desktop\
PS C:\Users\Nitish\Desktop> mvn archetype:generate \
>> -D archetypeGroupId=org.apache.isis.archetype \
>> -D archetypeArtifactId=simpleapp-archetype \
>> -D archetypeVersion=1.16.2 \
>> -D groupId=com.mycompany \
>> -D artifactId=myapp \
>> -D version=1.0-SNAPSHOT \
>> -B
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.114 s
[INFO] Finished at: 2018-03-20T15:42:22+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Nitish\Desktop). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
-D : The term '-D' 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.
At line:2 char:5
+ -D archetypeGroupId=org.apache.isis.archetype \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-D : The term '-D' 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.
At line:3 char:5
+ -D archetypeArtifactId=simpleapp-archetype \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-D : The term '-D' 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.
At line:4 char:5
+ -D archetypeVersion=1.16.2 \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-D : The term '-D' 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.
At line:5 char:5
+ -D groupId=com.mycompany \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-D : The term '-D' 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.
At line:6 char:5
+ -D artifactId=myapp \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-D : The term '-D' 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.
At line:7 char:5
+ -D version=1.0-SNAPSHOT \
+ ~~
+ CategoryInfo : ObjectNotFound: (-D:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-B : The term '-B' 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.
At line:8 char:5
+ -B
+ ~~
+ CategoryInfo : ObjectNotFound: (-B:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Am I missing out something?
As I was using Powershell I had to use the command :
mvn archetype:generate "-DarchetypeGroupId=org.apache.isis.archetype" "-DarchetypeArtif
actId=helloworld-archetype" "-DarchetypeVersion=1.16.2" "-DgroupId=com.mycompany" "-DartifactId=myapp" "-Dversion=1.0-SN
APSHOT" "-B"
For Unix, it should as below.
mvn archetype:generate \
-DarchetypeGroupId=org.apache.beam \
-DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
-DarchetypeVersion=2.14.0 \
-DgroupId=org.example \
-DartifactId=word-count-beam \
-Dversion="0.1" \
-Dpackage=org.apache.beam.examples \
-DinteractiveMode=false
If you want to use it in powershell replace backslash \ with backtick `
I'm executing the following command in PowerShell:
Invoke-Expression "openssl pkcs12 -in $certCN.pfx -nocerts -nodes -out $certCN.key -password pass:1111"
It works fine, however the output from openssl is causing ugly console errors:
openssl : MAC verified OK
At line:1 char:1
+ openssl pkcs12 -in www.mywebsite.com.pfx -nocerts -node ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MAC verified OK:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
What's the best way to execute this OpenSSL command and have the output ignored or at least not interpreted as a command?
You don't need Invoke-Expression (in fact, it's not recommended except in specific cases because it is susceptible to injection). Just run the command and quote the parameters where you need variable string expansion:
openssl pkcs12 -in "$certCN.pfx" -nocerts -nodes -out "$certCN.key" -password pass:1111
To ignore the output of the command, one common technique is to pipe to Out-Null.
In PowerShell, I use Plink to ssh on to a NetScaler device.
Everything works fine, but it takes a very long time to run the script because of the amount of data downloaded from the remote device to the local machine, where I'm running PowerShell.
Here is the script:
$log = C:\plink.exe -batch -l User -pw PWD 10.1.1.1 "shell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz""
To improve the performance, I need to reduce the amount of data transferred from the device.
All I need is just the first part of the domain \w+\ so I tried to add | cut –d . –f 1 but I get this:
cut : The term 'cut' 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.
At line:1 char:144
+ ... hell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f ...
+ ~~~
+ CategoryInfo : ObjectNotFound: (cut:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I’ve tried different ways to escape the | and trired putting the command into a variable or in to a file and using the –m switch.
Everything comes out with the same result.
The cut command works fine, when I use PuTTY to ssh to the device.
Is this problem with PowerShell, Plink or both? Can I use the cut command without a pipe? Or is there another way to return just the \w+\ part?
Here's the output from various attempts to get the cut working (not allowed to upload screenshots from work)
PS C:\windows\system32> C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS shell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1"
Done
^^^
ERROR: No such command
C:\NetScalerBackup\plink.exe : ERROR: No such command
At line:1 char:1
+ C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS shell ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ERROR: No such command:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PS C:\windows\system32> C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS "shell `"zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1`""
Done
^^^
ERROR: No such command
C:\NetScalerBackup\plink.exe : ERROR: No such command
At line:1 char:1
+ C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS "shell ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ERROR: No such command:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PS C:\windows\system32> C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS shell zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1
cut : The term 'cut' 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.
At line:1 char:122
+ ... shell zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f ...
+ ~~~
+ CategoryInfo : ObjectNotFound: (cut:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Update
#Martin:
when I try
"shell `"zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1`"`nexit`n" | C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS
I get:
shell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1"
exit
Done
> shell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1"
grep: unknown directories method
ERROR:
> exit
Bye!
If I take out the back-tick Quotes (`")
"shell zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f1`nexit`n" | C:\NetScalerBackup\plink.exe -batch -l $un -pw $pwd $PrimaryNS
This is the response:
Done
> shell zgrep -oE '\w+\.aramco\.com' /var/log/ns.log.0.gz | cut -d . -f1
^^^
ERROR: No such command
> exit
Bye!
The outer quotes are not needed by Plink and just complicate parsing. This should work:
$log = C:\plink.exe -batch -l User -pw PWD 10.1.1.1 shell "zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f"
If you want to keep the outer quotes, you have escape the inner quotes:
$log = C:\plink.exe -batch -l User -pw PWD 10.1.1.1 "shell `"zgrep -oE '\w+\.some\.com' /var/log/ns.log.0.gz | cut -d . -f`""