0

I am looking for powershell code for installing software packages in remote machines which are in ADS domain.While installing I have to pass my admin credentials. How can I do this? Guidance required

1
  • What part are you currently stuck on? Where is your PowerShell script so we can help you? Commented Apr 26, 2018 at 13:28

1 Answer 1

1

You can store your password to be used on a remote computer using the Get-Credential command like this:

`$Credential = Get-Credential

You'll see a prompt like this appear:

enter image description here

I would recommend storing the applications you need to install in a central place, that all of your remote devices can reach. I'll assume you've stored them in the UNC Path: \\FileServer\Application

Let's say you wanted to install 7Zip and had it present in that path:

$Credential = Get-Credential
$Computers = 'RemotePC1', 'RemotePC2'
Invoke-Command -ComputerName $Computers -Credential $Credential `
  -ScriptBlock {& \\FileServer\Application\7Zip.msi} -ArgumentList '/q INSTALLDIR="C:\Program Files\7-Zip"'
Sign up to request clarification or add additional context in comments.

2 Comments

Sir I am a learner in this area and not known much yet. I request you to please provide a complete code so that I can try
Try at least this and let me know how it works for you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.