Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"You must provide a value expression following the '+' operator" and other errors #1

Open
sceptapular opened this issue Aug 30, 2019 · 4 comments

Comments

@sceptapular
Copy link

PS C:\temp\rsat> .\W10_FOD_RSAT_Offline_CopySource.ps1
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:227

  • ... 3*,OpenSSH,Msix | ForEach-Object {copy-item -Path ($path+“:\â€� ...
  •                                                              ~
    

You must provide a value expression following the '+' operator.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:227

  • ... *,Msix | ForEach-Object {copy-item -Path ($path+“:\â€�+$_) -Desti ...
  •                                                   ~~~~~~~~~~~
    

Unexpected token '“:\�+$_' in expression or statement.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:227

  • ... 3*,OpenSSH,Msix | ForEach-Object {copy-item -Path ($path+“:\â€� ...
  •                                                              ~
    

Missing closing ')' in expression.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:203

  • ... s*,Holographic,NetFx3,OpenSSH,Msix | ForEach-Object {copy-ite ...
  •                                                             ~
    

Missing closing '}' in statement block or type definition.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:238

  • ... ,Msix | ForEach-Object {copy-item -Path ($path+“:\â€�+$_) -Destin ...
  •                                                             ~
    

Unexpected token ')' in expression or statement.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:21 char:285

  • ... th ($path+“:\â€�+$_) -Destination $dest.FullName -Force -Container}
  •                                                                     ~
    

Unexpected token '}' in expression or statement.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:27 char:19

  • copy-item ($path +“:"+“FoDMetadata_Client.cabâ€�) -Destination $ ...
  •               ~
    

You must provide a value expression following the '+' operator.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:29 char:43

  • Dismount-DiskImage -ImagePath "$FOD_Source"
  •                                       ~
    

The string is missing the terminator: ".
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:27 char:19

  • ... tem ($path +“:"+“FoDMetadata_Client.cabâ€�) -Destination $dest.F ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Unexpected token '“:"+“FoDMetadata_Client.cab�) -Destination $dest.FullName -Force -Container
#Dismount ISO
Dismount-DiskImage -ImagePath "$FOD_Source"' in expression or statement.
At C:\temp\rsat\W10_FOD_RSAT_Offline_CopySource.ps1:27 char:19

  • copy-item ($path +“:"+“FoDMetadata_Client.cabâ€�) -Destination $ ...
  •               ~
    

Missing closing ')' in expression.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : ExpectedValueExpression

@sceptapular
Copy link
Author

I was so pumped to finally get rolling on deploying RSAT with MDT, hit this snag early on sadly. I copied the script text, edited the iso path and destination folder and removed the line 21/22 line break, and that's what it's giving me. :(

@sceptapular
Copy link
Author

Ok, weird - I just copied and pasted each line one by one and it worked. Why would it be complaining when running the whole script?

@sceptapular
Copy link
Author

Success with line-by-line:
PS C:\temp\rsat> $FoD_Source = "C:\Temp\RSAT\Win10_1903_64_FOD1.ISO"
PS C:\temp\rsat>

Mount-DiskImage -ImagePath "$FoD_Source"

Attached : True
BlockSize : 0
DevicePath : \.\CDROM0
FileSize : 5174460416
ImagePath : C:\Temp\RSAT\Win10_1903_64_FOD1.ISO
LogicalSectorSize : 2048
Number : 0
Size : 5174460416
StorageType : 1
PSComputerName :

PS C:\temp\rsat>
PS C:\temp\rsat>

$path = (Get-DiskImage "$FoD_Source" | Get-Volume).DriveLetter
PS C:\temp\rsat> $lang = "en-US"
PS C:\temp\rsat> $dest = New-Item -ItemType Directory -Path "C:\temp\RSAT_1903_$lang" -force
PS C:\temp\rsat> Get-ChildItem ($path+":") -name -recurse -include *~amd64~~.cab,*~wow64~~.cab,*amd64$lang~.cab,*wow64$lang~.cab -exclude languagefeatures,Holographic,NetFx3,OpenSSH,Msix | ForEach-Object {copy-item -Path ($path+":"+$_) -Destination $dest.FullName -Force -Container}
PS C:\temp\rsat> copy-item ($path+":\metadata") -Destination $dest.FullName -Recurse
PS C:\temp\rsat> copy-item ($path +":"+"FoDMetadata_Client.cab") -Destination $dest.FullName -Force -Container
PS C:\temp\rsat> Dismount-DiskImage -ImagePath "$FOD_Source"

Attached : False
BlockSize : 0
DevicePath :
FileSize : 5174460416
ImagePath : C:\Temp\RSAT\Win10_1903_64_FOD1.ISO
LogicalSectorSize : 2048
Number :
Size : 5174460416
StorageType : 1
PSComputerName :

@sceptapular
Copy link
Author

Contents of script, which errors out when running the ps1:
#Specify ISO Source location

$FoD_Source = "C:\Temp\RSAT\Win10_1903_64_FOD1.ISO"

#Mount ISO

Mount-DiskImage -ImagePath "$FoD_Source"

$path = (Get-DiskImage "$FoD_Source" | Get-Volume).DriveLetter

#Language desired

$lang = "en-US"

#RSAT folder

$dest = New-Item -ItemType Directory -Path "C:\temp\RSAT_1903_$lang" -force

#get RSAT files

Get-ChildItem ($path+":") -name -recurse -include *~amd64~~.cab,*~wow64~~.cab,*amd64$lang~.cab,*wow64$lang~.cab -exclude languagefeatures,Holographic,NetFx3,OpenSSH,Msix | ForEach-Object {copy-item -Path ($path+“:\”+$_) -Destination $dest.FullName -Force -Container}

#get metadata

copy-item ($path+":\metadata") -Destination $dest.FullName -Recurse

copy-item ($path +“:"+“FoDMetadata_Client.cab”) -Destination $dest.FullName -Force -Container
#Dismount ISO
Dismount-DiskImage -ImagePath "$FOD_Source"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant