My goal for this script is to pull the IDs that are on one of the lookup sites that I have. This script allows me to log in and run the users names that are stored in a csv through the site.
cls
$username = “Test”
$password = ‘User’
write-host “Begin User Search `n”
write-host “Launching IE`n”
Creates a new instance of IE
$ie = New-Object -com InternetExplorer.Application
$html = $ie.document
Makes IE Visible
$ie.visible=$true;
Gives IE Time to load
start-sleep -milliseconds 2000
write-host “`nNavigating to PersonLookup”
Goes to PersonLookup Site
$ie.navigate(“https://www.test.com/default.aspx”);
write-host “`nLoging in”
while($ie.ReadyState -ne 4) {start-sleep -m 100}
Puts Credentials in the login form
$ie.document.getElementById(‘j_username’).value= “$username”
$ie.document.getElementById(‘j_password’).value = “$password”
$ie.document.getElementById(‘_idp_authn_lc_key’).click();
start-sleep 3
Starts the user lookup process
Gets the Users
cls
Import-Csv -Path ‘C:\users\Test\documents\check\Names.csv’ | ForEach-Object {
$LastName=$.GivenName
$FirstName=$.SurName
# Puts Last Name Information in the form
$ie.document.getElementById(‘dnn_ctr755_View_ctrlSearchCriteria_txtLastName’).value= $LastName
# Puts First Name Information in the form
$ie.document.getElementById(‘dnn_ctr755_View_ctrlSearchCriteria_txtFirstName’).value= $FirstName
# Submits the Information
$ie.document.getElementById(‘dnn_ctr755_View_ctrlSearchCriteria_ctrlCOBSearch’).click();
# Searches the Objects that were returned
$ie.document.getElementById(‘dnn_ctr755_View_ctrlPeopleSearchResult_gv_ctl02_ImageButton1’).click();
# Gets the PVI Information
$PVI = $ie.document.getElementById(“dnn_ctr755_View_ctl00_lbPVI”).innerHTML
$PVI | Out-File -FilePath ‘C:\users\Test\documents\check\Lookup.txt’ -append
start-sleep 3
}
This gets the first persons PVI ( ID ) and then it does not seem to work past $ie.document.getElementById(‘dnn_ctr755_View_ctrlSearchCriteria_ctrlCOBSearch’).click(); (inside the foreach loop).
I also included the script as an attachment