Script with Admin Credentials

Posted on 2012-08-30
Last Modified: 2012-09-28
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)
Question by:sumod_jacob
    LVL 14

    Accepted Solution

    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.

    Otherwise, you should be able to use native .NET too for user impersonation.

    Author Comment

    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..
    LVL 37

    Expert Comment

    by:Gerwin Jansen
    You could try copying as an admin from another machine to \\machine\c$ etc.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
    I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

    734 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

    23 Experts available now in Live!

    Get 1:1 Help Now