[Solved] Not able to fetch the individual details from JSON data

You don’t need to use foreach for this. You can just use Select-Object for this. Assuming your JSON is as @Mark Wragg linked in the comments: $Json = @’ [{ “Ns”: { “value”: [{ “Nname”: “exa”, “SR”: [{ “name”: “port1”, “properties”: { “description”: “Allow port1”, “destinationPortRange”: “1111”, “priority”: 100 } }, { “name”: “port1_0”, “properties”: … Read more

[Solved] How to check PowerShell disable by group policy using C#

There is a limitation called ExecutionPolicy, setting, which can prevent from running scripts from files. From C#, you can create an instance of InitialSessionState with ExecutionPolicy = ByPass and create Powershell with this initial session state. Then try to run your script file with Invoke-Command -FilePath command. solved How to check PowerShell disable by group … Read more

[Solved] How to add parameters and conn managers in Power shell script for SSIS

The root issue is the semicolon you are passing in for User::ProcessData is being interpreted as a delimiter for command line parameters and not as value inside a string. You can verify this behaviour by adding a semi-colon to the first property dtexec /ISServer “\SSISDB\DEV\PopulateData\PopulateData.dtsx” /server abbaa.com,3181 /Par “$ServerOption::SYNCHRONIZED(Boolean)”;True /SET \Package.Variables[User::Environment].Properties[Value];”[sql1811174];Dev” That will generate Argument … Read more

[Solved] Using Robocopy to list the big files in remote computer and save it as ServerName.CSV

In your previous questions your starting point was the Get-DfsrMembership cmdlet. In this question you’ve switched to starting with Get-ADComputer. What others have been trying to point out is properties returned from Get-DfdMembership aren’t available. In particular $_.ContentPath isn’t available in this scenario. Furthermore, Get-ADComputer returns a Name property not ComputerName. That said, your real … Read more

[Solved] PowerShell expression

It takes the contents of a file ‘InputName’, runs it through a regular expression and outputs it to the file ‘OutputName’. The expression takes something in front of a comma, plus the comma itself and concatenates it with something that’s behind a double backslash, some text, a backslash, some text and another backslash. So it … Read more

[Solved] Contents of file 1.txt between specific word in tag of file 2 in batch/powershell [closed]

Following should get you started $housenames = @(“Dagger Alley 1” “Steel Home” “Iron Alley 1” “Iron Alley 2” “Swamp Watch” “Salvation Street 2″ ) $xmlTemplate = @( ‘<house name=”” houseid=”2″ entryx=”0″ entryy=”0″ entryz=”0″ rent=”0″ townid=”0″ size=”93″ />’ ‘<house name=”” houseid=”4″ entryx=”0″ entryy=”0″ entryz=”0″ rent=”0″ townid=”0″ size=”68″ />’ ‘<house name=”” houseid=”5″ entryx=”0″ entryy=”0″ entryz=”0″ rent=”0″ townid=”0″ … Read more

[Solved] Running a django project with documentation based in linux on windows

I’m on Windows 10. If you’re not opposed to using Windows Command Prompt, here are the steps to running this project. I don’t use Powershell but if you must, see Powershell note at bottom of my answer. Go here: https://github.com/sajib1066/django-event-management Grab this clone link: https://github.com/sajib1066/django-event-management.git Open Windows CMD prompt. Change directory to a place on … Read more

[Solved] Filtering and Merging Many Large CSV Files [closed]

From a performance point of view you probably want to avoid Import-Csv/Export-Csv and go with a StreamReader/StreamWriter approach. Something like this: $inputFolder=”C:\some\folder” $outputFile=”C:\path\to\output.csv” $writer = New-Object IO.StreamWriter ($outputFile, $false) Get-ChildItem $inputFolder -File | Where-Object { … # <– filtering criteria for selecting input files go here } | ForEach-Object { $reader = New-Object IO.StreamReader ($_.FullName) … Read more

[Solved] I need help on a power shell script to create output file on C:\onsomepath after it compares a log file for a string value [closed]

You used Get-Content to get the content- you can use Set-Content to set it! Set-Content -Path C:\OnSomePath\Result.log -Value ‘No gather issue found on relay’ solved I need help on a power shell script to create output file on C:\onsomepath after it compares a log file for a string value [closed]

[Solved] Unable to trim string in PowerShell

try -replace to delete substrings by regex patterns PS> $string1=”abc_xyz-mnq_R81″ PS> $string2=”abc_xyz-mnq_R82″ PS> $string1 -replace “^.*_R” 81 PS> $string2 -replace “^.*_R” 82 0 solved Unable to trim string in PowerShell

[Solved] Trim multiple items CSV using PowerShell

Got it…..I’m sure there is a cleaner version of my regular expressions but it works. $Keywords=”\sVersion\sis\s.{2,16}”, ‘\sfound’, ‘\sshould.{2,40}’,’\sfile’ $Csv | ForEach-Object { ForEach($keyword in $Keywords){ $_.Results = $_.Results -replace $keyword,” }} $Csv | Export-Csv $FileOut -NoTypeInformation solved Trim multiple items CSV using PowerShell

[Solved] Get a list of network folders and the path to them [closed]

Continuing from my comment. For example: Listing Network Drives There are many ways to list mapped network drives. One of them uses PowerShell’s Get-PSDrive and checks to see whether the target root starts with “\”, indicating a UNC network path: Get-PSDrive -PSProvider FileSystem | Where-Object DisplayRoot -like ‘\\*’ # Results <# Name Used (GB) Free … Read more