Single quoted strings will not expand variables in PowerShell. Try a double quoted string e.g.:
"$computer\admin"
More Related Contents:
- Powershell Formatting for a String
- How can you use an object’s property in a double-quoted string?
- Powershell: passing json string to curl
- PowerShell outputting array items when interpolating within double quotes
- How do I pass variables with the Invoke-Command cmdlet?
- ‘kubectl patch’ works on Linux Bash but not in Windows Powershell ISE
- Why won’t Variable update?
- What does $($variableName) mean in expandable strings in PowerShell?
- Escaping the and (&) sign in Powershell
- Calling dynamic variable in PowerShell
- If Statement Against Dynamic Variable [duplicate]
- How do I call the PowerShell CLI robustly, with respect to character encoding, input and output streams, quoting and escaping?
- Create an incrementing variable from 2 variables in PowerShell
- Start-Process with PowerShell.exe exhibits different behavior with embedded single quotes and double quotes
- Using expanding strings as Powershell function parameters
- PowerShell string interpolation syntax
- Expanding variables in file contents
- Get-Aduser -Filter will not accept a variable
- Powershell executable isn’t outputting to STDOUT
- How to handle failed variable assignments in powershell? [duplicate]
- Dynamically create variables in PowerShell
- Timing a command’s execution in PowerShell
- Powershell pass variable to start-job
- Write-Host vs Write-Information in PowerShell 5
- Why does “Get-ChildItem -File | Get-FileHash” work?
- Get the drive letter of USB drive in PowerShell
- Powershell Using Start-Process in PSSession to Open Notepad
- Powershell Get-ChildItem most recent file in directory
- Executing powershell command directly in jenkins pipeline
- How can I redirect stdout and stderr without polluting PowerShell error output