3

I have a commandlet in my profile that reloads my user profile. Whenever I edit my profile VSCode warns me that the name I use—Reload-Profile—uses an unapproved verb.

While Reload seems like a sane, obvious and easily searchable verb to describe reloading a resource, I'd like to know what I should be using to keep PS happy. None of the candidates on the list of approved verbs seem to describe anything like reloading.

Here's the code BTW (I got it from this answer)

  function Reload-Profile {
    @($Profile.AllUsersAllHosts,
    $Profile.AllUsersCurrentHost,
    $Profile.CurrentUserAllHosts,
    $Profile.CurrentUserCurrentHost
    ) | ForEach-Object {
      if(Test-Path $_){
        Write-Host "Running $_" -foregroundcolor Magenta
        . $_
      }
    }
  }
stib
  • 3,346
  • 2
  • 30
  • 38
  • Possibly `sync` as listed in the approved verbs table. https://learn.microsoft.com/en-us/powershell/developer/cmdlet/approved-verbs-for-windows-powershell-commands – Drew Feb 27 '19 at 05:47
  • 1
    Sync seems a bit wrong though. I know I would never think of it when I was trying to work out what the command to reload the profile was. – stib Feb 27 '19 at 05:55
  • 1
    It isn't so much a refresh as a `get-`. Example. You Get AD data, then Set it, then get it again. – Drew Feb 27 '19 at 06:04
  • 1
    Maybe Reset / Restore / Redo? – Owain Esau Feb 27 '19 at 06:23
  • Yeah, I guess I am restoring it, even though most times I run the commandlet it's because I have changed my profile.ps1, so it's not going back to a previous state, it's more of an update. – stib Feb 27 '19 at 10:31

1 Answers1

4

I'd go with Invoke. Running a command is Invoke-Command, running a expression is Invoke-Expression, running pester is Invoke-Pester, and when Pester wants to run a mock, it's with Invoke-Mock, etc.

Invoke is the goto verb for asking something to execute.