Solved

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

Posted on 2012-12-27
10
1,161 Views
Last Modified: 2012-12-27
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
0
Comment
Question by:namerg
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 54

Expert Comment

by:McKnife
ID: 38724252
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!
0
 

Author Comment

by:namerg
ID: 38724272
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,
0
 
LVL 54

Expert Comment

by:McKnife
ID: 38724355
Sorry, simply missed "powershell". Not experienced in file operations via PS, sorry.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 250 total points
ID: 38724387
0
 

Author Comment

by:namerg
ID: 38724392
Jiji...I am reading that one...
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 38724584
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).
0
 

Author Comment

by:namerg
ID: 38724607
Damnn, you are right...too late to split points. :(
0
 

Author Comment

by:namerg
ID: 38725140
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.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38725354
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.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
A brief introduction to what I consider to be the best editor for PowerShell.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question