$credential to map to remote pc c: drives
$credential to map to remote pc c: drives
Hi All,I have a basic script that gets a list of pc's from a txt file then connects to each one of them and then searches an .ini file for a specific word, my problem is that it needs an admin account to connect to the list of pc's c: drives, i have the $credential at the begining of my code and it does ask for it but it still does not seem to use it to connect to the list of pc's, ca anyone help?Error i get back: Cannot find path 'CJ058694c$Program FilesCommon Filestest test SysAdminConfiggo.ini' because it does not exist.# used to cach cred.$credential = $nullif(Test-Path Variable:Lee.Holmes.CommonScript.CachedCredential){$credential = ${GLOBAL:Lee.Holmes.CommonScript.CachedCredential}}${GLOBAL:Lee.Holmes.CommonScript.CachedCredential} =Get-Credential $credential$credential = ${GLOBAL:Lee.Holmes.CommonScript.CachedCredential}$pathtopclist = Read-Host "Enter Full Path to PC List"$arrComputers = Get-Content -Path "$pathtopclist"$searchinput = Read-Host "Please Enter Your Search Word"foreach ($strComputer in $arrComputers){$credential$matches = Select-String -Simple "$searchinput" "$strComputerc$Program FilesCommon Filestest test SysAdminConfiggo.ini" $matches | select line,path | Format-List >> c:testgoini.csv }
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
$credential to map to remote pc c: drives
This forum is to provide support for SAPIEN community tools. If you take a look at the PowerShell section of our sister site www.scriptinganswers.com you will find a better location for this type of question.
http://www.scriptinganswers.com/forum2/ ... 157z58455d
http://www.scriptinganswers.com/forum2/ ... 157z58455d
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.