Advertisement
Guest User

ITProConNYC2016-WinTrack-NanoServer-3

a guest
Mar 29th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $PathtoWin2016Sources = "D:\NanoServer\Packages"
  2. $ReverseForwarders = "$PathtoWin2016Sources\Microsoft-OneCore-ReverseForwarders-Package.cab"
  3. $ReverseForwardersLP = "$PathtoWin2016Sources\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab"
  4.  
  5. $Demo3ServerName = "Nanolab-Nano1"
  6.  
  7. #####
  8. # Copying package files to a shared folder
  9.  
  10.  
  11. if(Test-Path Z:\NanoLab) {
  12.     Remove-Item Z:\NanoLab -Force
  13. }
  14. md Z:\NanoLab
  15. Copy-Item $ReverseForwarders -Destination Z:\NanoLab\ -Force
  16. md "Z:\NanoLab\en-us\"
  17. Copy-Item $ReverseForwardersLP -Destination Z:\NanoLab\en-us\ -Force
  18.  
  19.  
  20. #####
  21. # log in using domain account
  22.  
  23. Enter-PSSession -VMName $Demo3ServerName -Credential NANO\dsebban
  24.  
  25.  
  26. #####
  27. # Add Reverse Forwarders Package
  28.  
  29. $CabFiles = Get-ChildItem "C:\NanoLab" -filter *.cab -recurse
  30.  
  31. foreach ($cabfile in $CabFiles) {
  32.     dism /Add-Package /PackagePath:"$($cabfile.Fullname)" /Online
  33. }
  34.  
  35. shutdown /r /t 15
  36. Exit-PSSession
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement