79741744

Date: 2025-08-21 01:39:50
Score: 1
Natty:
Report link

I couldn't find any other way to create a share folder than creating it manually using PowerShell. This is what I did in my code. Thank you everyone for their replies.

- name: 'Create Folder shortcut on G: drive'
  ansible.windows.win_shell: |
    $WshShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut("G:\\Folder1.lnk")
    $Shortcut.TargetPath = "\\\\SERVER1\\Folder1"
    $Shortcut.Save()
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: MWH