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 Answer
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:
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"'
2 Comments
Raghavendra Nayaka
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
FoxDeploy
Try at least this and let me know how it works for you :)
