# encoding: ascii # api: powershell # title: Write-ScriptVariables # description: Print variables defined in the script (excludes global vars) # version: 0.1 # type: function # author: Ryan Smith # license: CC0 # function: Write-ScriptVariables # x-poshcode-id: 3836 # x-archived: 2012-12-22T08:33:40 # x-published: 2012-12-19T12:33:00 # # function Write-ScriptVariables { $globalVars = get-variable -scope Global | % { $_.Name } Get-Variable -scope Script | Where-Object { $globalVars -notcontains $_.Name } | Where-Object { $_.Name -ne 'globalVars' } | Out-String }