Jump to content

Look at local users mapped drives without bugging them


eDecisions
 Share

Recommended Posts

Ok this guy will display the users mapped drive of the user thats logged into the pc as well as the status of the drive, disconnected, Ok, ect...  Nice if you's setting up another pc remotely and you want to see what the shared drives on another users pc were so you can match them.

 

#by eDecisions

$Taskname = "netuse"
$lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser")

SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $Taskname /RU $lastlogon /TR "c:\maplist.bat"
start-sleep -s 1

New-Item c:\maplist.bat -ItemType "file"
Set-Content c:\maplist.bat 'net use >> c:\maplist.txt'

schtasks /Run /TN $Taskname
start-sleep -s 1
schtasks /delete /tn $Taskname /f

get-content -path c:\maplist.txt

del c:\maplist.txt
del c:\maplist.bat

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...