Monitoring Open URL

rated by 0 users
This post has 5 Replies | 1 Follower

Top 200 Contributor
Posts 14
fackeid Posted: 02-21-2012 2:03 PM

Hi

Can we list the currently open website (in firefox)

Because Task Manager shows the name of currently focused website name in application tab, and in process tab we see its respected process (firefox.exe)

Using cmd - tasklist  & ps> process shows me only process list (as mentioned above)

But i am interested to get the list of website which are currently open in browser (specifically firefox).. i guess if Task manager (application tab) is able to show it, then via Ps or WMI we can get it same.

 

I have attached screen print for better clarity.

Top 75 Contributor
Posts 38
PS C:\Users\Bryan> $a = get-process firefox
PS C:\Users\Bryan> $a | gm


   TypeName: System.Diagnostics.Process

Name                       MemberType     Definition
----                       ----------     ----------
Handles                    AliasProperty  Handles = Handlecount
Name                       AliasProperty  Name = ProcessName
NPM                        AliasProperty  NPM = NonpagedSystemMemorySize
PM                         AliasProperty  PM = PagedMemorySize
VM                         AliasProperty  VM = VirtualMemorySize
WS                         AliasProperty  WS = WorkingSet
Disposed                   Event          System.EventHandler Disposed(System.Ob
ErrorDataReceived          Event          System.Diagnostics.DataReceivedEventHa
Exited                     Event          System.EventHandler Exited(System.Obje
OutputDataReceived         Event          System.Diagnostics.DataReceivedEventHa
BeginErrorReadLine         Method         System.Void BeginErrorReadLine()
BeginOutputReadLine        Method         System.Void BeginOutputReadLine()
CancelErrorRead            Method         System.Void CancelErrorRead()
CancelOutputRead           Method         System.Void CancelOutputRead()
Close                      Method         System.Void Close()
CloseMainWindow            Method         bool CloseMainWindow()
CreateObjRef               Method         System.Runtime.Remoting.ObjRef CreateO
Dispose                    Method         System.Void Dispose()
Equals                     Method         bool Equals(System.Object obj)
GetHashCode                Method         int GetHashCode()
GetLifetimeService         Method         System.Object GetLifetimeService()
GetType                    Method         type GetType()
InitializeLifetimeService  Method         System.Object InitializeLifetimeServic
Kill                       Method         System.Void Kill()
Refresh                    Method         System.Void Refresh()
Start                      Method         bool Start()
ToString                   Method         string ToString()
WaitForExit                Method         bool WaitForExit(int milliseconds), Sy
WaitForInputIdle           Method         bool WaitForInputIdle(int milliseconds
__NounName                 NoteProperty   System.String __NounName=Process
BasePriority               Property       System.Int32 BasePriority {get;}
Container                  Property       System.ComponentModel.IContainer Conta
EnableRaisingEvents        Property       System.Boolean EnableRaisingEvents {ge
ExitCode                   Property       System.Int32 ExitCode {get;}
ExitTime                   Property       System.DateTime ExitTime {get;}
Handle                     Property       System.IntPtr Handle {get;}
HandleCount                Property       System.Int32 HandleCount {get;}
HasExited                  Property       System.Boolean HasExited {get;}
Id                         Property       System.Int32 Id {get;}
MachineName                Property       System.String MachineName {get;}
MainModule                 Property       System.Diagnostics.ProcessModule MainM
MainWindowHandle           Property       System.IntPtr MainWindowHandle {get;}
MainWindowTitle            Property       System.String MainWindowTitle {get;}
MaxWorkingSet              Property       System.IntPtr MaxWorkingSet {get;set;}
MinWorkingSet              Property       System.IntPtr MinWorkingSet {get;set;}
Modules                    Property       System.Diagnostics.ProcessModuleCollec
NonpagedSystemMemorySize   Property       System.Int32 NonpagedSystemMemorySize
NonpagedSystemMemorySize64 Property       System.Int64 NonpagedSystemMemorySize6
PagedMemorySize            Property       System.Int32 PagedMemorySize {get;}
PagedMemorySize64          Property       System.Int64 PagedMemorySize64 {get;}
PagedSystemMemorySize      Property       System.Int32 PagedSystemMemorySize {ge
PagedSystemMemorySize64    Property       System.Int64 PagedSystemMemorySize64 {
PeakPagedMemorySize        Property       System.Int32 PeakPagedMemorySize {get;
PeakPagedMemorySize64      Property       System.Int64 PeakPagedMemorySize64 {ge
PeakVirtualMemorySize      Property       System.Int32 PeakVirtualMemorySize {ge
PeakVirtualMemorySize64    Property       System.Int64 PeakVirtualMemorySize64 {
PeakWorkingSet             Property       System.Int32 PeakWorkingSet {get;}
PeakWorkingSet64           Property       System.Int64 PeakWorkingSet64 {get;}
PriorityBoostEnabled       Property       System.Boolean PriorityBoostEnabled {g
PriorityClass              Property       System.Diagnostics.ProcessPriorityClas
PrivateMemorySize          Property       System.Int32 PrivateMemorySize {get;}
PrivateMemorySize64        Property       System.Int64 PrivateMemorySize64 {get;
PrivilegedProcessorTime    Property       System.TimeSpan PrivilegedProcessorTim
ProcessName                Property       System.String ProcessName {get;}
ProcessorAffinity          Property       System.IntPtr ProcessorAffinity {get;s
Responding                 Property       System.Boolean Responding {get;}
SessionId                  Property       System.Int32 SessionId {get;}
Site                       Property       System.ComponentModel.ISite Site {get;
StandardError              Property       System.IO.StreamReader StandardError {
StandardInput              Property       System.IO.StreamWriter StandardInput {
StandardOutput             Property       System.IO.StreamReader StandardOutput
StartInfo                  Property       System.Diagnostics.ProcessStartInfo St
StartTime                  Property       System.DateTime StartTime {get;}
SynchronizingObject        Property       System.ComponentModel.ISynchronizeInvo
Threads                    Property       System.Diagnostics.ProcessThreadCollec
TotalProcessorTime         Property       System.TimeSpan TotalProcessorTime {ge
UserProcessorTime          Property       System.TimeSpan UserProcessorTime {get
VirtualMemorySize          Property       System.Int32 VirtualMemorySize {get;}
VirtualMemorySize64        Property       System.Int64 VirtualMemorySize64 {get;
WorkingSet                 Property       System.Int32 WorkingSet {get;}
WorkingSet64               Property       System.Int64 WorkingSet64 {get;}
PSConfiguration            PropertySet    PSConfiguration {Name, Id, PriorityCla
PSResources                PropertySet    PSResources {Name, Id, Handlecount, Wo
Company                    ScriptProperty System.Object Company {get=$this.Mainm
CPU                        ScriptProperty System.Object CPU {get=$this.TotalProc
Description                ScriptProperty System.Object Description {get=$this.M
FileVersion                ScriptProperty System.Object FileVersion {get=$this.M
Path                       ScriptProperty System.Object Path {get=$this.Mainmodu
Product                    ScriptProperty System.Object Product {get=$this.Mainm
ProductVersion             ScriptProperty System.Object ProductVersion {get=$thi

We can get one thing out of this. And that is Window Title.

PS C:\Users\Bryan> $a.MainWindowTitle
Monitoring Open URL - Powershell.com - Powershell Scripts, Tips and Resources - Nightly (13.0a1)

Getting the URL isn't the same as getting the title.

 

Top 200 Contributor
Posts 14

Hey

thanks Bryan.. you made my day... it worked.. but only thing is i need to add sleep function so that after every (say) interval it can capture the currently focuses URL (else it will point to the old cached URL only)

Thank you once again

 

Top 25 Contributor
Posts 296
Microsoft MVP
Top Contributor

This works for Internet Explorer

while ($true) {

Get-Process iexplore |
select -expandproperty MainWindowTitle

Start-Sleep -Seconds 5

}

Change the process and the time interval

Top 200 Contributor
Posts 14

hey thanks R Siddaway

 

It worked fantastic for me..

 

Not Ranked
Posts 1

This is really helpful info.

I am currently trying to find a way to close individual tabs within firefox. I'm not totally sure that it's even possible, but being a new powershell user I'm willing to waste a little time looking just to understand the shell better.

Page 1 of 1 (6 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.