title: Handling names with spaces
body: <p>My Puppet agent is Windows Server 2012. I am trying to grant db rights to an AD user. If i try assigning rights to an AD user that doesn't contain any space in its name, then the script works fine. Earlier, user name without space was also not working but when i added an extra slash (<code>'abc\\s_sql'</code>), it worked for that user. For user name with space, it's not working <em>at all</em> although Puppet shows it ran successfully.</p>
  
  <pre><code>[root@pe-server] cat grant_read.pp
  define db::grant_read (
      $grant_read_params
  ) {
      $grant_read_ps = $grant_read_params[grant_read_ps]
      $grant_read_sql = $grant_read_params[grant_read_sql]
      $read_user = $grant_read_params[read_user]
      $db_name = $grant_read_params[db_name]
  
      utils::powershell_script { "Grant read access to user $read_user on $db_name":
          script    =&gt; $grant_read_ps,
          parameter =&gt; "$grant_read_sql $read_user $db_name",
      }
  }
  
  
  [root@pe-server] cat site.pp
  node 'pe-agent.abc.com' {
      $grant_read_params_Support_PROD = {
          'grant_read_ps'  =&gt; 'c:/db/grant_read.ps1',
          'grant_read_sql' =&gt; 'c:/db/grant_read.sql',
          #'read_user'     =&gt; 'abc\\s_sql',
          'read_user'      =&gt; 'abc\\APP Support_PROD',
          'db_name'        =&gt; 'ABC_MASTER',
      }
  
      db::grant_read { "Granting read access to tom on some db":
          grant_read_params =&gt; $grant_read_params_Support_PROD
      }
  }
  
  
  [root@pe-server] cat powershell_script.pp
  define utils::powershell_script (String $script, String $parameter = '') {
      $powershell = 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NoLogo -NonInteractive'
      exec { "Running $script on agent with parameter $parameter":
              command =&gt; "$powershell -File $script $parameter",
              logoutput =&gt; 'on_failure',
              timeout   =&gt; 900,
      }
  }
  </code></pre>
  
  <p>Tried several permutations and combinations both in the site.pp file argument and grant_read.pp file but nothing seems to be working. </p>
  
  <p>Any idea how i can handle this?</p>