<?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 Re: Get and expand the PM_VOLUME_NAME environment variable via Windows batch in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Get-and-expand-the-PM-VOLUME-NAME-environment-variable-via-Windows-batch/m-p/60731#M12646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dennis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;@echo off&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;for /f "delims=: tokens=1,2" %%a in ("%PM_VOLUME_NAME%") do set HOST=%%a&amp;amp;set VOLUME=%%b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;echo.Host&amp;nbsp; : %HOST%&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;echo.Volume: %VOLUME%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;dfm run cmd %HOST% vol options %VOLUME% nosnap on&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if %errorlevel% 1 echo.error with dfm command&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;exit 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;It is &lt;STRONG&gt;extremely important &lt;/STRONG&gt;that your provisioning script always exits with a return code of zero (0).&amp;nbsp; Even if your script fails for some reason, you want it to return zero. Any other return code causes the entire provisioning job ro be rolled-back.&amp;nbsp; Use logging to capture the return status of commands so you can troubleshoot the script later without causing your provisioning job to be rolled-back.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Reid&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Aug 2012 12:08:12 GMT</pubDate>
    <dc:creator>reide</dc:creator>
    <dc:date>2012-08-08T12:08:12Z</dc:date>
    <item>
      <title>Get and expand the PM_VOLUME_NAME environment variable via Windows batch</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Get-and-expand-the-PM-VOLUME-NAME-environment-variable-via-Windows-batch/m-p/60726#M12643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to be able to turn off the array based snapshot schedule on a particular volume once it has been provisioned through Provisioning Manager. Turns out you can use a post provisioning script to do so as long as you can get at the PM_VOLUME_NAME environment variable. Through my travels in the community I have learned there is a PERL way of expanding all of the variables in %ENV. See below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp; foreach $key (sort(keys %ENV))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; if ($key =~ /^PM_/) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; print "$key: $ENV{$key}\n";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also learned the the PM_VOLUME_NAME is returned as &lt;EM&gt;&lt;STRONG&gt;filer:/vol/volume&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@echo off&lt;/P&gt;&lt;P&gt; set vol_name=&lt;SPAN style="color: #ff0000;"&gt;&lt;EM&gt;&lt;STRONG&gt;PM_VOLUME_NAME&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; for /f "delims=: tokens=1,2" %%a in ("%vol_name%") do dfm run cmd %%a vol options %%b nosnap on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am missing the Windows batch equivalent of being able to get and expand PM_VOLUME_NAME into vol_name so I can manipulate it in the next line of the script. Anybody have this lying around?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 06:21:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Get-and-expand-the-PM-VOLUME-NAME-environment-variable-via-Windows-batch/m-p/60726#M12643</guid>
      <dc:creator>dmccray</dc:creator>
      <dc:date>2025-06-05T06:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get and expand the PM_VOLUME_NAME environment variable via Windows batch</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Get-and-expand-the-PM-VOLUME-NAME-environment-variable-via-Windows-batch/m-p/60731#M12646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dennis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;@echo off&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;for /f "delims=: tokens=1,2" %%a in ("%PM_VOLUME_NAME%") do set HOST=%%a&amp;amp;set VOLUME=%%b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;echo.Host&amp;nbsp; : %HOST%&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;echo.Volume: %VOLUME%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;dfm run cmd %HOST% vol options %VOLUME% nosnap on&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if %errorlevel% 1 echo.error with dfm command&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;exit 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;It is &lt;STRONG&gt;extremely important &lt;/STRONG&gt;that your provisioning script always exits with a return code of zero (0).&amp;nbsp; Even if your script fails for some reason, you want it to return zero. Any other return code causes the entire provisioning job ro be rolled-back.&amp;nbsp; Use logging to capture the return status of commands so you can troubleshoot the script later without causing your provisioning job to be rolled-back.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Reid&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2012 12:08:12 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Get-and-expand-the-PM-VOLUME-NAME-environment-variable-via-Windows-batch/m-p/60731#M12646</guid>
      <dc:creator>reide</dc:creator>
      <dc:date>2012-08-08T12:08:12Z</dc:date>
    </item>
  </channel>
</rss>

