Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script analyzer warns about unused variables when variable is used in Invoke-Command #825

Open
DanrwAU opened this issue Oct 24, 2017 · 0 comments

Comments

@DanrwAU
Copy link

DanrwAU commented Oct 24, 2017

Hi Guys,

Script Analyzer is flagging a few variables as not used anywhere in the script.

These variables are only used during an Invoke-Command line when is calling them like below

Invoke-Command -Session $S -ScriptBlock {$VMDet = Get-VM $VM}
$VMDetails = Invoke-Command -Session $S -ScriptBlock {$VMDet}

Script analyzer is throwing file: '
message: 'The variable 'VMDet' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)'
at: '665,62'
source: 'PSScriptAnalyzer'

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants