Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get-ISEMRU {
- [cmdletbinding()]
- Param()
- <#
- Path will be something like:
- C:\Users\Jeff\AppData\Local\microsoft_corporation\powershell_ise.exe_StrongName_lw2v2vm3wmtzzpebq33gybmeoxukb04w
- #>
- $ISEPath = "$env:localappdata\microsoft_corporation\powershell_ise*\3.0.0.0"
- Try {
- $folder = (Resolve-Path -Path $ISEPath -ErrorAction Stop).Path
- }
- Catch {
- Write-Warning "Failed to get ISE folder from $ISEPath"
- Write-Warning $_.exception.message
- #Bail out
- Return
- }
- If ($folder) {
- #construct the path to user.config
- $path = Join-Path -Path $folder -ChildPath "user.config"
- #verify the file exists just in case
- if (Test-Path -path $path) {
- #using -Raw sends everything at once as a huge string
- #and boosts performance a bit.
- [xml]$xml = Get-Content -Path $path -Raw
- #get the MRU setting as a string using an XPath filter
- $xml.SelectNodes('//setting[@name="MRU"]').Value.ArrayOfString.string
- }
- else {
- Write-Warning "Can't find $path"
- }
- } #if $folder
- } #end Get-ISEMRU
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement