Skip to content
Advertisement

Tag: powershell

diff compare directories by filename only

Is it possible to use any sort of diff utility to diff based on filename only, excluding the file extensions? I have multiple dirs that have various versions of a file, ie media.mov, media.mp4, media.jpg, etc. I want to make sure all versions were made for each file (1000s). So /dir1/media_99.mov and /dir2/media_99.mp4 would yield a TRUE condition. Man diff

Powershell for Linux: Combining commands with pipe sign doesn’t work

Any way to concatenate commands in Powershell for Linux? This is what I’m trying to run: pwsh -Command Invoke-ScriptAnalyzer -Path . | ConvertTo-Json | Out-File -FilePath “/home/administrator/scripts/test.json” So, run the Invoke-ScriptAnalyzer, convert the results to Json and save the result to test.json. It doesn’t recognize anything after the | sign: ./test.sh: line 1: ConvertTo-Json: command not found ./test.sh: line 1:

Powershell Linux Sharepoint Management

I installed powershell (pwsh) on Ubuntu 20.4. I am trying to manage some Sharepoint stuff. I did the following: And it installed. So, I thought. I cannot access any commands, such as Get-SPOSiteDesign, etc. I list the modules I have: From the following result, it seems the problem is that there are not any ExportedCommands from the Microsoft.Online.SharePoint.PowerShell package. What

Cannot convert string to boolean – ansible to powershell on linux

I read this whole thread about how to pass boolean values to a parameter to powershell on Linux. Nothing worked for me. My code in Ansible is as follows: I’ve used many variants, such as -ParticipateInCEIP:False, or -ParticipateInCEIP False, or -ParticipateInCEIP $false, but I get always the same error, that it expects boolean, but I sent string. I am running

Invoke-WebRequest Always Fails For HTTPS. The remote certificate is invalid according to the validation procedure

I’m trying to use Invoke-WebRequest inside of pwsh (on Linux), but it’s always failing. Here’s an example: The site/URL doesn’t matter, if it’s using HTTPS I’ll get the error. The exact same script on a Windows machine works without issue. $PSVersionTable dotnet –version 3.1.403 openssl version OpenSSL 1.0.1e-fips 11 Feb 2013 I know it’s possible to disable SSL validation on

How to print a list of xml elements and their properties in the Powershell REPL console?

Referencing: https://www.red-gate.com/simple-talk/sysadmin/powershell/powershell-data-basics-xml/ and: https://stackoverflow.com/a/65264118/4531180 how is a list of elements and their properties printed? Answer To address the for-display formatting problem: If you look closely at the sample output from your own answer, you’ll see that even though the display is mostly helpful, the value of the author property is author instead of showing the (presumed) first-name and last-name child-element

How to convert this powershell script to bin/sh script?

How to convert this script: or with parameter: How to make similar script that works in linux /bin/sh? I want to copy files to some network location (windows shared folder). There is no scp on windows server and i cannot install anything. Answer On Linux, you’ll need the following (verified on Ubuntu 18.04, albeit not with a Windows domain account):

Count the number of characters, words and lines in PowerShell

In Linux we have the “wc” command which allows us to count the number of characters, words and lines in a file. But do we have a similar cmdlet in PowerShell. The Measure-Object cmdlet I tried could only count the number of lines but not the characters and words. Answer It counts the number of characters in the file. It

How to compare two files containing many long strings then extract lines with at least n consecutive identical chars?

I have 2 large files each containing long strings separated by newlines in different formats. I need to find similarities and differences between them. The Problem is that the formats of the two files differ. File a: File b: So now I want to extract the whole line containing NjA5MDAxNdaeag0NjE5NTIx.XUwXRQ.gat8MzuGfkj2pWs7z8z-LBFXQaE from File a to a new file and also delete

Advertisement