I tried to find a way to join or use variable into a command. I'm trying to create a command that accept parameters: The command: aduser.ps1 John
aduser.ps1 script:
Param($User)
Get-AdUser -filter 'Name -like "*$user*"'
I had error and not sure what operator to use to join in the $user
variables, i tried + or & and not working for me.
变量不会在单引号字符串内扩展,而是将其替换为双引号:
Get-AdUser -filter "Name -like '*$user*'"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.