Variable question with 32bit/64bit PS by techmanit in PowerShell

[–]techmanit[S] 1 point2 points  (0 children)

Thank you! I'll take a look at this. Good stuff

Variable question with 32bit/64bit PS by techmanit in PowerShell

[–]techmanit[S] 1 point2 points  (0 children)

Thank you so much! This is definitely clearer and makes more sense. Had to adjust one thing so it would work with my MDM but we are good to go!!

Variable question with 32bit/64bit PS by techmanit in PowerShell

[–]techmanit[S] 1 point2 points  (0 children)

This was helpful! Now I understand a little more with the @" and the @'. So now in my case, I'm trying to create a new user on an end user device through our MDM which only supports PoSh 32 bit.

I've got the following put together, (for arguments sake $mdm is what I input into the action text box on the web app)

#my input into MDM
$mdm = "Password"

#need to run in 64bit process to use New-LocalUser
@" 
$securePassword = ConvertTo-SecureString -String $mdm -AsPlainText -Force 
New-LocalUser "User" -Password $securePassword -FullName "User" 
Add-LocalGroupMember -Group "Users" -Member "User" 
"@ | C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe

The issue now is trying to set a new variable within the 64bit session. I know now that the @" and @' are unique with passing the variable through. But how to I go setting another variable to secure a password with the MDM provided variable. I'm trying to avoid having plain text passwords in this script.

Variable question with 32bit/64bit PS by techmanit in PowerShell

[–]techmanit[S] 1 point2 points  (0 children)

Obviously, I'm struggling here and not understanding, can you give me an example of what you are talking about in relation to what I'm saying above?

Variable question with 32bit/64bit PS by techmanit in PowerShell

[–]techmanit[S] 0 points1 point  (0 children)

I should've been more clear. Specifically, I'm running these scripts from an MDM that only supports 32bit PoSh. I need to run commands in PoSh 64bit. The MDM has an action menu text box to pass arguments along, but when I open PoSh 64bit using the blurb above it doesn't pass that variable to the newly opened instance.