Solved

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

Posted on 2012-12-27
10
1,132 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 53

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 53

Expert Comment

by:McKnife
ID: 38724355
Sorry, simply missed "powershell". Not experienced in file operations via PS, sorry.
0
 
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 68

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 68

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

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now