Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Find References to Uninitialized Variables in PowerShell

$
0
0

Summary: Easily find references to uninitialized variables in Windows PowerShell.

Hey, Scripting Guy! Question My extremely long script keeps failing and I suspect it may be because of variables that are not
           initialized prior to being used. How can I find uninitialized variables?

Hey, Scripting Guy! Answer Use the Set-StrictMode cmdlet and set it to –version 1 to ensure that all references to 
           initialized variables generate an error:

Set-StrictMode –version 1


Viewing all articles
Browse latest Browse all 3333

Trending Articles