steffan182

Generate RDP shortcuts from CSV file

Apr 7th, 2020 (edited)
2,009
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Generate RDP shortcuts from CSV file
  2. ## Coded by steffan182
  3. ## Check my book out! Lazy I.T: The Path to Efficiency - https://www.amazon.com/dp/B09B3C64G5
  4.  
  5. ## Fills out Computer, Username, and Server Name fields
  6. ## Multi-monitor enabled
  7.  
  8. ##  CSV File looks something like this:
  9. ##  Username,CName
  10. ##  User.Name1,CName01
  11. ##  User.Name2,CName02
  12.  
  13.  
  14. $csv= Import-CSV '.\Clients.csv'
  15.  
  16. foreach($csv1 in $csv)
  17. {
  18. $Uname = $csv1.Username
  19. $CName = $csv1.CName
  20. $Domain = "DomainName"
  21. $DomainSfx = "local"
  22. $GtwyHstNm = "rds.gateway.com"
  23.  
  24.  
  25. Out-File -FilePath .\$CName.rdp
  26.  
  27. $RDP = "
  28. screen mode id:i:2
  29. use multimon:i:1
  30. desktopwidth:i:800
  31. desktopheight:i:600
  32. session bpp:i:32
  33. winposstr:s:0,3,0,0,800,600
  34. compression:i:1
  35. keyboardhook:i:2
  36. audiocapturemode:i:0
  37. videoplaybackmode:i:1
  38. connection type:i:7
  39. networkautodetect:i:1
  40. bandwidthautodetect:i:1
  41. displayconnectionbar:i:1
  42. username:s:$Domain\$UName
  43. enableworkspacereconnect:i:0
  44. disable wallpaper:i:0
  45. allow font smoothing:i:0
  46. allow desktop composition:i:0
  47. disable full window drag:i:1
  48. disable menu anims:i:1
  49. disable themes:i:0
  50. disable cursor setting:i:0
  51. bitmapcachepersistenable:i:1
  52. full address:s:$CName.$Domain.$DomainSfx
  53. audiomode:i:0
  54. redirectprinters:i:1
  55. redirectcomports:i:0
  56. redirectsmartcards:i:1
  57. redirectclipboard:i:1
  58. redirectposdevices:i:0
  59. autoreconnection enabled:i:1
  60. authentication level:i:2
  61. prompt for credentials:i:0
  62. negotiate security layer:i:1
  63. remoteapplicationmode:i:0
  64. alternate shell:s:
  65. shell working directory:s:
  66. gatewayhostname:s:$GtwyHstNm
  67. gatewayusagemethod:i:2
  68. gatewaycredentialssource:i:4
  69. gatewayprofileusagemethod:i:1
  70. promptcredentialonce:i:1
  71. gatewaybrokeringtype:i:0
  72. use redirection server name:i:0
  73. rdgiskdcproxy:i:0
  74. kdcproxyname:s:
  75. "
  76.  
  77. $RDP | Out-File -FilePath .\$CName.rdp
  78. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment