Title: How to include variable in -Newname in powershell
Tags: powershell;windows-10;rename-item-cmdlet
Question: Via power-shell script, trying to add $Album variable to naming sequence.
Tried write host, variable is working. Have tried things like () [] {} "" '' . ect.
The goal is to get $Album to work in this line below: {0:D2}$Album.mxf
$i = 1
$Artist = " Name"
$Type = "Type"
$Location = "Loc"
$Month = "Month"
$Year = "2019"
$Album = "$Artist $Type $Location $Month $Year"
# Write-Host -ForegroundColor Green -Object $Album;
Get-ChildItem *.mxf | %{Rename-Item $_ -NewName ('{0:D2}$Album.mxf' -f $i++)}
Before:
Misc name - 1.mxf
Misc name - 4.mxf
Misc name - 6.mxf
Current:
01$Album.mxf
02$Album.mxf
03$Album.mxf
01 Name Type Loc Month 2019.mxf
02 Name Type Loc Month 2019.mxf
03 Name Type Loc Month 2019.mxf
Comment: Use double-quotes here `"{0:D2}$Album.mxf"` so the variable `$Album` gets expanded.

Here is the accepted answer: Your own answer is effective, but it is awkward in two respects:
It mixes expandable strings (string interpolation inside "...") with template-based string formatting via the -f operator.
It uses % (ForEach-Object) to launch Rename-Item for every input object, which is quite inefficient.
Here's a solution that provides a remedy, by using -f consistently and by using a delay-bind script block:
$Artist = " Name"
$Type = "Type"
$Location = "Loc"
$Month = "Month"
$Year = "2019"
$Album = "$Artist $Type $Location $Month $Year"
$i = 1
Get-ChildItem *.mxf |
Rename-Item -NewName { '{0:D2} {1}.mxf' -f ([ref] $i).Value++, $Album }
Note the use of ([ref] $i).Value++ to increment the value of $i, which is necessary, because the delay-bind script block passed to -NewName runs in a child scope - see this answer for details.
Note that $script:i++ is a pragmatic alternative, but less flexible than the solution above - see the linked answer.

Here is another answer: Answered by @Theo in comment
Use double-quotes here "{0:D2}$Album.mxf" so the variable $Album gets expanded.
$i = 1
$Artist = " Name"
$Type = "Type"
$Location = "Loc"
$Month = "Month"
$Year = "2019"
$Album = "$Artist $Type $Location $Month $Year"
# Write-Host -ForegroundColor Green -Object $Album;
Get-ChildItem *.mxf | %{Rename-Item $_ -NewName ("{0:D2}$Album.mxf" -f $i++)}
Before:
Misc name - 1.mxf
Misc name - 4.mxf
Misc name - 6.mxf
After:
01 Name Type Loc Month 2019.mxf
02 Name Type Loc Month 2019.mxf
03 Name Type Loc Month 2019.mxf

Here is another answer: Or like this (works both in an interactive session and in a script).  And you want a space before $album.
Get-ChildItem *.mxf | Rename-Item -NewName { "{0:D2} $Album.mxf" -f $script:i++ }
EDIT:  There is another way.  It is little known that foreach-object can take 3 script blocks (begin/process/end).  -process can take a script block array as documented.  You can always test these things with -whatif.
Get-ChildItem *.mxf |
foreach { $i = 1 } { Rename-Item $_ -NewName ("{0:D2} $Album.mxf" -f $i++) -whatif }

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:06/30/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<powershell><windows-10><rename-item-cmdlet>', 'Title': 'How to include variable in -Newname in powershell', 'ViewCount': 305, 'id': 56823262, 'user_AboutMe': None, 'user_AccountId': None, 'user_DisplayName': None, 'user_Reputation': None, 'user_Views': None, 'user_id': None}}