Im working on a way to use powershell to create a shortcut to a network folder using values from two different lists. I have the code to create the shortcut but now I need it to reference values from the list to make a shortcut. My googlefu has failed me in finding an easy way to accomplish this.
Here is the code for the shortcut, I found through google:
Here is the code again for the values I need to change:
X=First Row of List 1
Y=First row of List 2
Here is sample of the data I am working with:
List 1:
1. Client1
2. Client2
List 2:
1. Client1 Network Folder
2. Client2 Network Folder
I can make the lists how ever they need to be, but I just need a way to easily generate a shortcut from this list. Research shows powershell can import a CSV, I am just not sure how to reference/create the "loop" for it to make all shortcuts at once. Any help is appreciated.
Here is the code for the shortcut, I found through google:
Code:
$strDesktopFolder = "C:\test"
$objShell = New-Object -com "Wscript.Shell"
$objShortcut = $objShell.CreateShortcut($strDesktopFolder + "\PleaseSaveMe.lnk")
$objShortcut.TargetPath = "\\myserver\folder"
$objShortcut.Save()
Here is the code again for the values I need to change:
Code:
$strDesktopFolder = "C:\test"
$objShell = New-Object -com "Wscript.Shell"
$objShortcut = $objShell.CreateShortcut($strDesktopFolder + "\X.lnk")
$objShortcut.TargetPath = "Y"
$objShortcut.Save()
X=First Row of List 1
Y=First row of List 2
Here is sample of the data I am working with:
List 1:
1. Client1
2. Client2
List 2:
1. Client1 Network Folder
2. Client2 Network Folder
I can make the lists how ever they need to be, but I just need a way to easily generate a shortcut from this list. Research shows powershell can import a CSV, I am just not sure how to reference/create the "loop" for it to make all shortcuts at once. Any help is appreciated.