title: Powershell - create new Outlook profile on Remote computer
body: <p>I have script which successfully creates new Outlook profile but I would like to achieve that I can do this on remote computer.
  Basically I connect to target PC using Client Center for Configuration Manager and I launch PS script which closes and creates new Outlook profile.</p>
  <p>The main idea is to upload this script on CCCM folder on server where I have all scripts. Before I proceed with that I tested and tried connect to target PC and then open console and then run this PS script and nothing happened.
  Is it because execution from &quot;Open console&quot; is different then if script is uploaded on server &quot;Run custom Powershell scripts&quot;?
  In other scripts I don't point to remote or target pc in scripts and they just work.
  So the question is, is there mistake on my script and that is the reason why it does not proceed on target PC or I just need to upload it on server.</p>
  <p>Thank you!</p>
  <pre><code>
      if($process=(get-process 'outlook' -ErrorAction SilentlyContinue))
  {
      Write-Host &quot;Outlook is open, closing app..&quot; -ForegroundColor Green
      kill($process)
      Write-Host &quot;Outlook is Closed&quot; -ForegroundColor Green
  }
  
  $reg=&quot;HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles&quot;
  $child=(Get-ChildItem -Path $reg).name
  foreach($item in $child)
  {
      Remove-item -Path registry::$item -Recurse #-ErrorAction Inquire -WhatIf
  }
  
  Write-Host &quot;All profiles removed successfully&quot; -ForegroundColor Green
  &quot;`n&quot;
  Write-Host &quot;Now create new profile for outlook&quot; -ForegroundColor Green
  &quot;`n&quot;
  New-Item -Name &quot;Outlook_new&quot; -Path $reg -Force -Verbose
  Write-Host &quot;New profile created&quot; -ForegroundColor Green
  &quot;`n&quot;
  Write-Host &quot;Launch Outlook with newly created profile&quot; -ForegroundColor Green
  Start-Process 'outlook' -ErrorAction SilentlyContinue -ArgumentList '/profile &quot;outlook&quot; 
  </code></pre>