$credential to map to remote pc c: drives

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
This topic is 15 years and 3 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
dcdelgado
Posts: 40
Last visit: Tue Feb 17, 2015 9:29 am

$credential to map to remote pc c: drives

Post by dcdelgado »

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 }
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

$credential to map to remote pc c: drives

Post by Alexander Riedel »

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
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
dcdelgado
Posts: 40
Last visit: Tue Feb 17, 2015 9:29 am

$credential to map to remote pc c: drives

Post by dcdelgado »

thanks.
This topic is 15 years and 3 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.