• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

Script with Admin Credentials

I have to copy a data file (imisloc.df1) to C:\Proram files\ASI\iMIS15, getting an error access denied with login user rights.. how to integrate domain admin credential in to the script to copy? (*.bat or ps)
0
sumod_jacob
Asked:
sumod_jacob
1 Solution
 
athomsfereCommented:
with .bat, you can use the third party Sanur, and then compile to an invisible running .exe to hide the password...

Or with Powershell... there are  a few ways. Some are Powershell specific.
http://stackoverflow.com/questions/3887933/impersonation-in-powershell-access-remote-file

Otherwise, you should be able to use native .NET too for user impersonation.
0
 
sumod_jacobAuthor Commented:
I tried below, but getting an error,
+ CategoryInfo          : NotImplemented: (:) [], PSNotSupportedException
 + FullyQualifiedErrorId : NotSupported

Command i tried
Copy-Item p:\imis15\imisloc.df1 "C:\Program Files\ASI\iMIS15" -Credential domainusername
Its prompt for password, but end up in above error..
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You could try copying as an admin from another machine to \\machine\c$ etc.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now