How To Open Microsoft Edge As "Mobile Agent" via Powershell ?

anshulmathur

Power Member
Joined
Nov 5, 2014
Messages
584
Reaction score
194
Hi,

I want to open Microsoft Edge as a mobile agent and search for a query.
The script/code I have is working on a normal browser profile, but I want to make searches as mobile.

Can anyone please help in modifying the code?
Will be thankful. Here's the code I am using.

for ($a = 0; $a -lt 10; $a++){
$RandomSpace = Get-Random -InputObject ("&")
$RandomWord = Get-Random -InputObject (get-content C:\Users\GeeK\Desktop\Images\RandomWordList.txt)
$RandomQuestion = Get-Random -InputObject("What+is+","How+to+download","prefixes+for+","suffixes+for+")
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList "--profile-directory=`"Default`" http://www.google.com/search?q=$RandomQuestion$RandomWord" -WindowStyle Minimized
start-sleep -Milliseconds 3000
}

Regards
 
Code:
for ($a = 0; $a -lt 10; $a++){
$RandomSpace = Get-Random -InputObject ("&")
$RandomWord = Get-Random -InputObject (get-content C:\Users\GeeK\Desktop\Images\RandomWordList.txt)
$RandomQuestion = Get-Random -InputObject("What+is+","How+to+download","prefixes+for+","suffixes+for+")
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList "--user-agent='Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'" "--profile-directory=`"Default`" http://www.google.com/search?q=$RandomQuestion$RandomWord" -WindowStyle Minimized
start-sleep -Milliseconds 3000
}

You can add more user-agent if you want.

Good luck :)
 
Code:
for ($a = 0; $a -lt 10; $a++){
$RandomSpace = Get-Random -InputObject ("&")
$RandomWord = Get-Random -InputObject (get-content C:\Users\GeeK\Desktop\Images\RandomWordList.txt)
$RandomQuestion = Get-Random -InputObject("What+is+","How+to+download","prefixes+for+","suffixes+for+")
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList "--user-agent='Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'" "--profile-directory=`"Default`" http://www.google.com/search?q=$RandomQuestion$RandomWord" -WindowStyle Minimized
start-sleep -Milliseconds 3000
}

You can add more user-agent if you want.

Good luck :)

Hey, thank you for the quick help.
Though I am getting this error. What does it mean?

I am really sorry; I am novice to scripting.

1671459262394.png
 
Try this. since its google we cannot really chanllege them could be many reasons

Code:
$randomWordListFile = "C:\Users\GeeK\Desktop\Images\RandomWordList.txt"
$randomWords = Get-Content $randomWordListFile
$randomQuestions = "What+is+", "How+to+download", "prefixes+for+", "suffixes+for+"
$edgeExePath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
$userAgents = @(
    "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
    "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1"
)
$iterations = 10
for ($i = 0; $i -lt $iterations; $i++) {
    $randomSpace = Get-Random -InputObject "&"
    $randomWord = Get-Random -InputObject $randomWords
    $randomQuestion = Get-Random -InputObject $randomQuestions
    $searchUrl = "http://www.google.com/search?q=$randomQuestion$randomWord"
    Start-Process -FilePath $edgeExePath -ArgumentList $userAgents, "--profile-directory=`"Default`"", $searchUrl -WindowStyle Minimized
    Start-Sleep -Milliseconds 3000
}

Good luck :)
 
Try this. since its google we cannot really chanllege them could be many reasons

Code:
$randomWordListFile = "C:\Users\GeeK\Desktop\Images\RandomWordList.txt"
$randomWords = Get-Content $randomWordListFile
$randomQuestions = "What+is+", "How+to+download", "prefixes+for+", "suffixes+for+"
$edgeExePath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
$userAgents = @(
    "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
    "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1"
)
$iterations = 10
for ($i = 0; $i -lt $iterations; $i++) {
    $randomSpace = Get-Random -InputObject "&"
    $randomWord = Get-Random -InputObject $randomWords
    $randomQuestion = Get-Random -InputObject $randomQuestions
    $searchUrl = "http://www.google.com/search?q=$randomQuestion$randomWord"
    Start-Process -FilePath $edgeExePath -ArgumentList $userAgents, "--profile-directory=`"Default`"", $searchUrl -WindowStyle Minimized
    Start-Sleep -Milliseconds 3000
}

Good luck :)

Hi, thank you for the update, Sir.
I tried using it with Bing too, but it is showing this error.

1671460291490.png
 
What error are you getting with google url ? dont use bing
 
try this once.

Objective-C:
for ($a = 0; $a -lt 10; $a++){
$RandomSpace = Get-Random -InputObject ("&")
$RandomWord = Get-Random -InputObject (get-content C:\Users\GeeK\Desktop\Images\RandomWordList.txt)
$RandomQuestion = Get-Random -InputObject("What is ","How to download","prefixes for ","suffixes for ")
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList ("--user-agent='Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'", "--profile-directory='Default'", "http://www.google.com/search?q=$RandomQuestion$RandomWord") -WindowStyle Minimized
start-sleep -Milliseconds 3000
}
 
try this once.

Objective-C:
for ($a = 0; $a -lt 10; $a++){
$RandomSpace = Get-Random -InputObject ("&")
$RandomWord = Get-Random -InputObject (get-content C:\Users\GeeK\Desktop\Images\RandomWordList.txt)
$RandomQuestion = Get-Random -InputObject("What is ","How to download","prefixes for ","suffixes for ")
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList ("--user-agent='Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'", "--profile-directory='Default'", "http://www.google.com/search?q=$RandomQuestion$RandomWord") -WindowStyle Minimized
start-sleep -Milliseconds 3000
}

It opened a lot of tabs by taking the Agent Command as input

1671462133008.png

1671462191535.png

1671462198630.png
 
check your pm i have sent you alternative code.
 
Back
Top