wnet

Is it possible to get a valid token from a remote computer?

Is it possible to impersonate a u/p on a remote computer? Ideally I would like to call the ImpersonateLoggedOnUser with a token I would obtain from logging into a remote computer. I know I can make a valid connection using wnet functions, but just don't know about impersonation. ...

Calling WNetAddConnection2 from PowerShell

I am trying to directly call some Win32 API's from a PowerShell script. I managed to make WNetAddConnection work with the code below: $cp = New-Object Microsoft.CSharp.CSharpCodeProvider $cpar = New-Object System.CodeDom.Compiler.CompilerParameters $Code = @" using System; using System.Runtime.InteropServices; namespace Win32Api { ...

Calling WNetAddConnection2 with empty local name

I have a small program that simply checks if a specified file is located on a specified network drive that is not mapped on the computer. To check this I temporarily map to the network location, check if the file exists and than unmap the drive. I now figured out that I can call WNetAddConnection2 with an empty local name (MSDN: If the s...