Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Function Get-ISEMRU {
  2.  
  3. [cmdletbinding()]
  4. Param()
  5.  
  6. <#
  7. Path will be something like:
  8. C:\Users\Jeff\AppData\Local\microsoft_corporation\powershell_ise.exe_StrongName_lw2v2vm3wmtzzpebq33gybmeoxukb04w
  9. #>
  10. $ISEPath = "$env:localappdata\microsoft_corporation\powershell_ise*\3.0.0.0"
  11.  
  12. Try {
  13. $folder = (Resolve-Path -Path $ISEPath -ErrorAction Stop).Path
  14. }
  15. Catch {
  16. Write-Warning "Failed to get ISE folder from $ISEPath"
  17. Write-Warning $_.exception.message
  18. #Bail out
  19. Return
  20. }
  21.  
  22. If ($folder) {
  23. #construct the path to user.config
  24. $path = Join-Path -Path $folder -ChildPath "user.config"
  25.  
  26. #verify the file exists just in case
  27. if (Test-Path -path $path) {
  28. #using -Raw sends everything at once as a huge string
  29. #and boosts performance a bit.
  30. [xml]$xml = Get-Content -Path $path -Raw
  31.  
  32. #get the MRU setting as a string using an XPath filter
  33. $xml.SelectNodes('//setting[@name="MRU"]').Value.ArrayOfString.string
  34. }
  35. else {
  36. Write-Warning "Can't find $path"
  37. }
  38. } #if $folder
  39.  
  40. } #end Get-ISEMRU
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement