You are not logged in.
Pages: 1
hi
a small gift for members of SS64
Function Get-ss64 {
<#
.Example
PS[1]> Get-ss64
DateTime Author Title State
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge Offline
07/12/2011 05:17:36 theretard FORFILES help Offline
06/12/2011 15:06:22 theretard avoiding loop Offline
06/12/2011 03:05:54 theretard %CommonProgramFiles... Offline
05/12/2011 20:02:05 theretard get file location t... Offline
...
...
.Example
PS[2]> Get-ss64 -Today
DateTime Author Title State
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge Offline
07/12/2011 05:17:36 theretard FORFILES help Offline
.Example
PS[3]> get-ss64 | Where { $_.Author -eq 'jumper' } | select Title,DateTime
.Example
PS[4]> get-ss64 | Where { $_.state -eq 'Online' }
.INPUTS
none
.OUTPUTS
PSCUSTOMOBJECT
#>
param([Switch]$Today)
End{
try{
$objTable = @()
$objweb = New-Object net.webclient
[Xml]$objXml = $objweb.DownloadString('http://ss64.org/extern.php?action=feed&type=atom')
$objTable += $objXml.feed.entry | Select-Object -Property @{
Name = 'DateTime'
Expression = { $_.updated -as [datetime] }
},@{
Name = 'Author'
Expression = { $_ | select -expand author | % { $_.name.'#cdata-section' } }
},@{
Name = 'Title'
Expression = { $_ | select -expand FirstChild | % { $_.'#cdata-section' } }
},@{
Name = 'State'
Expression = {
$objlink = New-Object net.webclient
$link = $_ | select -Expand link | select -Expand href
$page = $objlink.DownloadString($link)
$Matches.Clear()
$prst = $page -match 'offline|Online'
$Matches[0]
$objlink.Dispose()
Remove-Variable objlink
}
}
}
catch [System.Net.WebException] { return $_.exception.message }
finally{
$objweb.Dispose()
if($Today) {
$objTable | % { $_.DateTime -eq (date) }
} else { $objTable }
}
}
}
Offline
tipo
Function Get-ss64 {
<#
.Example
PS[1]> Get-ss64
DateTime Author Title Online
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge True
07/12/2011 05:17:36 theretard FORFILES help False
06/12/2011 15:06:22 theretard avoiding loop False
06/12/2011 03:05:54 theretard %CommonProgramFiles... False
05/12/2011 20:02:05 theretard get file location t... False
...
...
.Example
PS[2]> Get-ss64 -Today
DateTime Author Title Online
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge False
07/12/2011 05:17:36 theretard FORFILES help False
.Example
PS[3]> get-ss64 | Where { $_.Author -eq 'jumper' } | select Title,DateTime
.Example
PS[4]> get-ss64 | Where { $_.state -eq 'Online' }
.Example
PS[5]> get-ss64 | Select -first 3
.INPUTS
none
.OUTPUTS
PSCUSTOMOBJECT
#>
param([Switch]$Today)
End{
try{
$objTable = @()
$objweb = New-Object net.webclient
[Xml]$objXml = $objweb.DownloadString('http://ss64.org/extern.php?action=feed&type=atom')
$objTable += $objXml.feed.entry | Select-Object -Property @{
Name = 'DateTime'
Expression = { $_.updated -as [datetime] }
},@{
Name = 'Author'
Expression = { $_ | select -expand author | % { $_.name.'#cdata-section' } }
},@{
Name = 'Title'
Expression = { $_ | select -expand FirstChild | % { $_.'#cdata-section' } }
},@{
Name = 'Online'
Expression = {
$page = ''
$objlink = New-Object net.webclient
$link = $_ | select -Expand link | select -Expand href
$page = $objlink.DownloadString($link)
$page -match 'online'
$objlink.Dispose()
Remove-Variable objlink
}
}
}
catch [System.Net.WebException] { return $_.exception.message }
finally{
$objweb.Dispose()
if($Today) {
$objTable | % { $_.DateTime -eq (date) }
} else { $objTable }
}
}
}
Offline
Function Get-ss64 {
<#
.Example
PS[1]> Get-ss64
DateTime Author Title Online
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge True
07/12/2011 05:17:36 theretard FORFILES help False
06/12/2011 15:06:22 theretard avoiding loop False
06/12/2011 03:05:54 theretard %CommonProgramFiles... False
05/12/2011 20:02:05 theretard get file location t... False
...
...
.Example
PS[2]> Get-ss64 -Today
DateTime Author Title Online
-------- ------ ----- -----
07/12/2011 05:21:02 theretard merge False
07/12/2011 05:17:36 theretard FORFILES help False
.Example
PS[3]> get-ss64 | Where { $_.Author -eq 'user' } | select Title,DateTime
.Example
PS[4]> get-ss64 -invoke
# open browser
.Example
PS[5]> get-ss64 | Select -first 3
.INPUTS
none
.OUTPUTS
PSCUSTOMOBJECT
#>
param([Switch]$Today,[Switch]$Invoke)
End{
try{
$objTable = @()
$objweb = New-Object net.webclient
[Xml]$objXml = $objweb.DownloadString('http://ss64.org/extern.php?action=feed&type=atom')
$objTable += $objXml.feed.entry | Select-Object -Property @{
Name = 'DateTime'
Expression = { $_.updated -as [datetime] }
},@{
Name = 'Author'
Expression = { $_ | select -expand author | % { $_.name.'#cdata-section' } }
},@{
Name = 'Title'
Expression = { $_ | select -expand FirstChild | % { $_.'#cdata-section' } }
},@{
Name = 'Online'
Expression = {
$page = ''
$objlink = New-Object net.webclient
$link = $_ | select -Expand link | select -Expand href
$page = $objlink.DownloadString($link)
$page -match 'online'
$objlink.Dispose()
Remove-Variable objlink
}
}
if($Today) {
$objTable | Where { $_.DateTime -eq (date) }
} else { $objTable }
if($Invoke) {
start $($objXml.feed.entry | select -expand link | % { $_.href })[0]
}
}
catch [System.Net.WebException] { return $_.exception.message }
finally{
$objweb.Dispose()
}
}
}
Offline
so how do you make powershell post the post here for you?
Offline
I made mistakes in the first two code
Offline
so how do you make powershell post the post here for you?
You need to scroll within the posts above to see all the code.
Offline
Pages: 1