set objShare=Nothing
set objShare= GetOBJect("WinNT://" & strSrv &"/lanmanserver")
WScript.echo "Server Name = " & strSrv
For Each share in objShare
WScript.echo "Examining " & share.name
wscript.echo "\\" & strSrv & "\" & share.name
$server = [adsi]"WinNT://$strSrv/lanmanserver"
Argh. I didn't mean to hit send. This seems to me like it should be
the equivalent, but maybe not because it doesn't give me a list of
shares. That does work if you want to use similar syntax to work on a
group.
$server = "serverName"
$shares = [ADSI]"WinNT://$server/lanmanserver"
$shares.psbase.children | select @{n="ShareName";e={$_.properties.name}},@{n="LocalPath";e={$_.properties.path}}
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar
t> On Sep 10, 5:19 pm, tojo2000 <tojo2...@gmail.com> wrote:
t>
>> On Sep 10, 2:12 pm, jmull...@idahopower.com wrote:
>>
>>> is there an powershell equivelant to this that does not use the WMI
>>> provider method?
>>>
>>> set objShare=Nothing
>>>
>>> set objShare= GetOBJect("WinNT://" & strSrv &"/lanmanserver")
>>>
>>> WScript.echo "Server Name = " & strSrv
>>>
>>> For Each share in objShare
>>>
>>> WScript.echo "Examining " & share.name
>>>
>>> wscript.echo "\\" & strSrv & "\" & share.name
>>>
>> $server = [adsi]"WinNT://$strSrv/lanmanserver"
>>
t> Argh. I didn't mean to hit send. This seems to me like it should be
t> the equivalent, but maybe not because it doesn't give me a list of
t> shares. That does work if you want to use similar syntax to work on
t> a group.
t>
Shay's solution works in PowerShell v2 CTP2. In v1 you have to
remove .properties
$server = "serverName"
$shares = [ADSI]"WinNT://$server/lanmanserver"
$shares.psbase.children | select
@{n="ShareName";e={$_.name}},@{n="LocalPath";e={$_.path}}
Calculated properties are used to remove {} around property values.
(You can try $shares.psbase.children | select name,path).
-aleksandar
http://powershellers.blogspot.com
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar
a> On Sep 11, 10:05 am, Shay Levy [MVP] <n...@addre.ss> wrote:
a>
>> Try this:
>>
>> $server = "serverName"
>> $shares = [ADSI]"WinNT://$server/lanmanserver"
>> $shares.psbase.children | select
>> @{n="ShareName";e={$_.properties.name}},@{n="LocalPath";e={$_.propert
>> ies.pa th}}
>> ---
>> Shay Levy
>> Windows PowerShell
>> MVPhttp://blogs.microsoft.co.il/blogs/ScriptFanatic
>> PowerShell Toolbar:http://tinyurl.com/PSToolbar
a> Shay's solution works in PowerShell v2 CTP2. In v1 you have to remove
a> .properties
a>
a> $server = "serverName"
a> $shares = [ADSI]"WinNT://$server/lanmanserver"
a> $shares.psbase.children | select
a> @{n="ShareName";e={$_.name}},@{n="LocalPath";e={$_.path}}
a> Calculated properties are used to remove {} around property values.
a> (You can try $shares.psbase.children | select name,path).
a>
a> -aleksandar
a> http://powershellers.blogspot.com
Mmm data parsing ADS
(WinNT or LDAP or IIS)?
Perhaps something usable
(local or remote) with any
Windows process?
LogParser.exe -h -i:ads
Input format: ADS (Active Directory)
Returns properties of Active Directory objects
Here using the Windows automation tool,
Windows PowerShell, automating the data
parsing tool, Log Parser.
$server = "."
LogParser.exe "SELECT
ObjectName AS ShareName,
PropertyValue AS FileSystemPath
FROM 'WinNT://$server/lanmanserver'
WHERE ObjectClass = 'FileShare'
AND
PropertyName = 'Path' " `
-i ads -stats off
If one has any troubles, just ask any Windows
automation tool user for help!
Have some fun - Log Parser it.