Test-Path (folder) on multiple servers
hi.
i trying identify of servers has folder named ptia1000 under c:/program files
i getting server names txt file
this ive came with:
get-content "c:\tstjek\servers.txt" | ` select-object @{name='computername';expression={$_}},@{name='folderexist';expression={test-path "c:\program files\ptia1000"}}
this output:
(the output shows false, know fact ptia1000 folder exist on couple of these servers)
computername folderexist------------ -----------
srvpctx100 false
srvpctx101 false
srvpctx102 false
srvpctx103 false
srvpctx104 false
srvpctx105 false
srvpctx106 false
srvpctx107 false
srvpctx108 false
srvpctx109 false
srvpctx110 false
srvpctx111 false
srvpctx112 false
srvpctx113 false
srvpctx114 false
srvpctx115 false
srvpctx116 false
srvpctx117 false
srvpctx118 false
srvpctx119 false
srvpctx120 false
srvpctx121 false
srvpctx122 false
srvpctx123 false
srvpctx124 false
srvpctx125 false
srvpctx126 false
srvpctx127 false
what doing wrong?
have nice day
your issue test-path expression specify c:\program files\ptia1000, check drive of machine script ran from, try changing unc path so
\\$_\c$\program files\ptia1000
if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.
don't retire technet
Windows Server > Windows PowerShell
Comments
Post a Comment