<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Converting Lun Serial to Serialhex - CMODE using Powershell in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Converting-Lun-Serial-to-Serialhex-CMODE-using-Powershell/m-p/448634#M6828</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a way to convert a LUN SerialNumber to a Serial-hex using powershell - unfortunately this is not an option off the get-nclun&amp;nbsp; applet.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to use a CSV column containing Lun Serials as my data source and replace the data with the serial-hex. I initially tried this&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;# Replace 'input.csv' and 'output.csv' with your file paths&lt;/DIV&gt;&lt;DIV&gt;$inputFile = 'input.csv'&lt;/DIV&gt;&lt;DIV&gt;$outputFile = 'output.csv'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Read the CSV file&lt;/DIV&gt;&lt;DIV&gt;$data = Import-Csv $inputFile&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Convert the 'ColumnName' column from decimal to hexadecimal&lt;/DIV&gt;&lt;DIV&gt;$data = $data | ForEach-Object {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; $_.ColumnName = [Convert]::ToString([int]$_.ColumnName, 16)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; $_&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Export the updated data to a new CSV file&lt;/DIV&gt;&lt;DIV&gt;$data | Export-Csv -Path $outputFile -NoTypeInformation&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However&amp;nbsp; an error of this type is returned for each line - "Cannot convert value "83J6k$UbONg6" to type "System.Int32". Error: "Input string was not in a correct format."&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I found this article&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Any-way-to-get-lun-serial-number-in-hex-through-powershell/m-p/28647" target="_blank" rel="noopener"&gt;https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Any-way-to-get-lun-serial-number-in-hex-through-powershell/m-p/28647&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However when the concept to CMODE&amp;nbsp; I am getting back an 82 character string as opposed to the 24 character I would expect.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;I have also tried format-hex and other functions but what mechanism I use I end up with an incorrect result. Additionally I&amp;nbsp; seem to be encountering is the use of '$' in the Lun Serials which confuses powershell.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2023 13:31:53 GMT</pubDate>
    <dc:creator>Diarmuid</dc:creator>
    <dc:date>2023-11-03T13:31:53Z</dc:date>
    <item>
      <title>Converting Lun Serial to Serialhex - CMODE using Powershell</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Converting-Lun-Serial-to-Serialhex-CMODE-using-Powershell/m-p/448634#M6828</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a way to convert a LUN SerialNumber to a Serial-hex using powershell - unfortunately this is not an option off the get-nclun&amp;nbsp; applet.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to use a CSV column containing Lun Serials as my data source and replace the data with the serial-hex. I initially tried this&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;# Replace 'input.csv' and 'output.csv' with your file paths&lt;/DIV&gt;&lt;DIV&gt;$inputFile = 'input.csv'&lt;/DIV&gt;&lt;DIV&gt;$outputFile = 'output.csv'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Read the CSV file&lt;/DIV&gt;&lt;DIV&gt;$data = Import-Csv $inputFile&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Convert the 'ColumnName' column from decimal to hexadecimal&lt;/DIV&gt;&lt;DIV&gt;$data = $data | ForEach-Object {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; $_.ColumnName = [Convert]::ToString([int]$_.ColumnName, 16)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; $_&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Export the updated data to a new CSV file&lt;/DIV&gt;&lt;DIV&gt;$data | Export-Csv -Path $outputFile -NoTypeInformation&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However&amp;nbsp; an error of this type is returned for each line - "Cannot convert value "83J6k$UbONg6" to type "System.Int32". Error: "Input string was not in a correct format."&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I found this article&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Any-way-to-get-lun-serial-number-in-hex-through-powershell/m-p/28647" target="_blank" rel="noopener"&gt;https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Any-way-to-get-lun-serial-number-in-hex-through-powershell/m-p/28647&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However when the concept to CMODE&amp;nbsp; I am getting back an 82 character string as opposed to the 24 character I would expect.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;I have also tried format-hex and other functions but what mechanism I use I end up with an incorrect result. Additionally I&amp;nbsp; seem to be encountering is the use of '$' in the Lun Serials which confuses powershell.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 13:31:53 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Converting-Lun-Serial-to-Serialhex-CMODE-using-Powershell/m-p/448634#M6828</guid>
      <dc:creator>Diarmuid</dc:creator>
      <dc:date>2023-11-03T13:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Lun Serial to Serialhex - CMODE using Powershell</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Converting-Lun-Serial-to-Serialhex-CMODE-using-Powershell/m-p/448670#M6831</link>
      <description>&lt;P&gt;Use the &lt;SPAN&gt;ConvertTo-HexString&lt;/SPAN&gt; function in that linked article.&amp;nbsp; It works just fine with the cluster mode serial.&amp;nbsp; There are several ways to get Powershell to ignore special characters in data.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 16:07:31 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Converting-Lun-Serial-to-Serialhex-CMODE-using-Powershell/m-p/448670#M6831</guid>
      <dc:creator>RobDBA</dc:creator>
      <dc:date>2023-11-06T16:07:31Z</dc:date>
    </item>
  </channel>
</rss>

