How come I got this error?

%3CLINGO-SUB%20id%3D%22lingo-sub-2108688%22%20slang%3D%22en-US%22%3EHow%20come%20I%20got%20this%20error%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2108688%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20cannot%20call%20a%20method%20on%20a%20null-valued%20expression.%3CBR%20%2F%3EAt%20H%3A%5CTest.ps1%3A%20109%20char%3A26%20%2B%20If%20(%24ie%20-ne%20%24null)%20%7B%20%24ie.Document.parentWindow.scrollTo(0%2C1300)%20%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2108688%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2108862%22%20slang%3D%22en-US%22%3ERe%3A%20How%20come%20I%20got%20this%20error%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2108862%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F124684%22%20target%3D%22_blank%22%3E%40Yuansheng%20Zhang%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDepend%20on%20the%20%24ie%20Object%20Type.%3C%2FP%3E%3CP%3EType%20the%20following%3C%2FP%3E%3CP%3E%24ie.gettype()%26nbsp%3B%20%23What%20is%20the%20output%3C%2FP%3E%3CP%3Eif%20you%20type%20%24ie%20only%2C%20what%20is%20the%20output%3C%2FP%3E%3CP%3Eit%20seems%20that%20the%20%24ie%20variable%20is%20not%20holding%20any%20value.%3C%2FP%3E%3CP%3Ewhere%20is%20the%20value%20of%20%24ie%20from%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

You cannot call a method on a null-valued expression.
At H:\Test.ps1: 109 char:26 + If ($ie -ne $null) { $ie.Document.parentWindow.scrollTo(0,1300) }

1 Reply

@Yuansheng Zhang 

Depend on the $ie Object Type.

Type the following

$ie.gettype()  #What is the output

if you type $ie only, what is the output

it seems that the $ie variable is not holding any value.

where is the value of $ie from