About 3,200,000 results
Open links in new tab
  1. Convert an array to xml with customized element tag name

    Dec 21, 2012 · $load = @(@(1, 2), @(3)) $Load | % { "[$_]" } $Date = Get-Date "2012-01-01" $xml = $Load | % { @(, @{ ID = $_; Date = $Date }) } | ConvertTo-Xml -NoTypeInformation …

  2. Powershell Adding items from text file to 2 dimensional array

    May 25, 2018 · The following will produce what you want (an array of arrays btw, not an actual 2-d array) $result = get-content data.txt | foreach { , ($_ -split ',')} In this code, reading the data will …

  3. Powershell Multidimensional Arrays - Stack Overflow

    Jun 24, 2014 · For anyone who wants to use multidimensional arrays, you would use the GetLength method to get the number of elements for a specific dimension. For example, …

  4. Powershell add an item to an xml array property - Dotnet Helpers

    Now in this post, we will discuss how to add the value to the Array or Object from the XML using Powershell. PowerShell has XPath but you don’t have necessarily have to use it. Instead of …

  5. XML Manipulation in PowerShell: A Comprehensive Guide

    Nov 14, 2020 · Once an XML document is loaded into memory, you can use various methods and properties to parse and query the data. PowerShell provides several built-in methods and …

  6. Reading XML with PowerShell Get-Content | by McKrex - Medium

    Dec 23, 2024 · I made three discoveries about PowerShell while chasing down a bug in a script that cast a file’s content to XML: Arrays are automatically joined into strings with space (" ") as …

  7. PowerShell and XML: A Practical Guide

    Jul 21, 2023 · Use the Get-Content cmdlet to read the XML file, and then cast it to [xml]: # Read an XML file $xml = [xml](Get-Content "C:\path\to\your\file.xml") # Access elements …

  8. Mastering PowerShell Import XML: A Quick Guide

    The `Import-XML` cmdlet in PowerShell allows you to read XML data from a file and convert it into a usable object format for easy manipulation and querying. Here's a code snippet …

  9. Create PowerShell 2-Dimensional Array From XML Configuration File

    Apr 14, 2017 · $ThisComputerId = 'work' $ProjectsConfigFile = [xml](Get-Content -Path D:\Temp\PsProjects.xml) $ComputerNode = …

  10. Powershell, XML & Arrays - Stack Overflow

    Mar 29, 2012 · function create-7zip([String] $aDirectory, [String] $aZipfile){ [string]$pathToZipExe = "C:\Program Files\7-zip\7z.exe"; [Array]$arguments = "a", "-tzip", "$aZipfile", "$aDirectory", " …

Refresh