2

We have a PowerShell script script.ps1 on a hidden shared folder \\Server\Share$. We have a bat file Initiator.bat, which executes the script. The shortcut to the batch file is placed on the user's desktop, which is where they run it from.

Everything works fine with normal share, but when I changed the share to a hidden share by putting a $ at the end, the remote execution does't work, even though I have updated the shortcut.

It doesn't even give a error, it simply shows a command window. It immediately works if the $ is removed from the share.

Should I be using a different syntax? How do I make the scripts work and execute when they are on a hidden share?

MDMarra
  • 100,734
  • 32
  • 197
  • 329
Darktux
  • 827
  • 5
  • 21
  • 36

1 Answers1

2

There's nothing special about a share ending with a $, other than the fact that it isn't listed when browsing shares on that server with explorer or net view. If I were a betting man, I'd wager that you missed adding a $ somewhere (or escaping it in PS, as @jscott points out).

If you post the contents of the .bat and .ps1, then we'll be able to give you more specific feedback if necessary.

MDMarra
  • 100,734
  • 32
  • 197
  • 329
  • 1
    Or missed escaping said `$` – jscott Feb 04 '13 at 19:15
  • Got it, my bad everything was correct but i forgot to change the powershell line in batch file to share$; shortcut was pointing to correct bat file but bat file was not pointing to correct ps1 file; thats why its hung while executing batch.I think it works now. – Darktux Feb 04 '13 at 21:02
  • Glad to be able to help! – MDMarra Feb 04 '13 at 21:09