With Powershell How to authenticate into a workgroup computer C$ from a Domain computer ?

namerg
namerg used Ask the Experts™
on
Hello all,

I have a domain computer & user domain where I run all my scripts. But, in my current case I need to authenticate into a workgroup computer in order to get a file

File is located at \\computername\c$\folder\file.csv

Thanks for your help,
G
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018

Commented:
Hi.

There is a difference if the target computer runs vista/7 or 8 compared to win xp - so what OS is it?

If the administrative share c$ is accessible (share active, not blocked by a firewall, option described here set http://support.microsoft.com/kb/942817 ), then simply connect a network drive and use credentials like this:
user: targetsystemname\adminoftargetsystem
pw: anythingbutnotempty!
namergSystems Administrator

Author

Commented:
The target is a Server 2008, but in my testing I am using a Win7 in a workgroup mode.

Via GUI i can do \\computername\c$\folder\ and i get prompted then I get access but I want to avoid that and do it via powershell

Thanks for your help,
Distinguished Expert 2018

Commented:
Sorry, simply missed "powershell". Not experienced in file operations via PS, sorry.
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

namergSystems Administrator

Author

Commented:
Jiji...I am reading that one...
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
You can still use the "DOS" net use for authenticating. Just execute
 net use \\targetserver\c$ /u:targetserver\targetadmin targetpwd
and you should be able to access the drive as \\targetserver\c$ from PS. That is still easier than to set up Remoting, though Remoting is the better way if you want to execute stuff remotely (not just get some files).
namergSystems Administrator

Author

Commented:
Damnn, you are right...too late to split points. :(
namergSystems Administrator

Author

Commented:
Qlemo,

I am trying to do the following

Clear-Host
Start-Sleep -Seconds 5
net use Z: \\computername\c$ /u:computername\username 'password'

But, I do not see the Z drive.

By the way, i did open a question about it.

Thanks for your help.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
If you post a follow-up question, please provide the link, so we do not have to search for it ;-).

I've tested to map a network drive, and had no issues with accessing it using a drive letter. Whatsoever, the New-PSDrive method shown in the other question is the "better"  method as it is fully integrated into PS. Be aware that the drives mapped with New-PSDrive are not visible to DOS commands.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial