$ie = new-object -com internetexplorer.application
$ie.visible=$true
$ie.navigate('https://google.co.in')
while($ie.ReadyState -ne 4)
{
Write-Host "dom is loading"
$ie.ReadyState -eq 4
$ie.ReadyState -eq 3
$ie.ReadyState -eq 2
$ie.ReadyState -eq 1
$ie.ReadyState -eq 0
start-sleep -M 100
}
($ie.Document.Document3_getElementsByTagName('a')|where-object{$_.innerText -eq "मराठी"}).click()
Try to get Admin Access before running script
Use Below Script before running your script. It will Provide you admin access to run your Script
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;
if ($myWindowsPrincipal.IsInRole($adminRole))
{
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)";
Clear-Host;
}
else {
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
$newProcess.Arguments = "& '" + $script:MyInvocation.MyCommand.Path + "'"
$newProcess.Verb = "runas";
[System.Diagnostics.Process]::Start($newProcess);
Exit;
}