Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
1  
Or missed escaping said $ –  jscott Feb 4 '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 4 '13 at 21:02
    
Glad to be able to help! –  MDMarra Feb 4 '13 at 21:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.