Joe13 Posted August 23, 2019 Report post Posted August 23, 2019 Hi all, I need some help and it might be something easy. I have no scripting skills and tried various methods on the internet but it's not working. All I want is for the TS to ask me what computer name I want for the deployment, some sort of popup. Quote Share this post Link to post Share on other sites More sharing options...
0 Joe13 Posted August 23, 2019 Report post Posted August 23, 2019 Ok I'm trying this one now Still looking for one which will use mac addresses from txt file. Quote Share this post Link to post Share on other sites More sharing options...
0 Joe13 Posted August 23, 2019 Report post Posted August 23, 2019 I have the following in a PS script but the TS fails. [string] $MacAddress = Get-WmiObject Win32_networkadapterconfiguration | where {$_.ipenabled -match "True"} | select -ExpandProperty MacAddress | select -First 1 [string[]]$TextFiles = Get-Content \\fileshare\*.txt foreach ($element in $TextFiles){ [string[]]$TextFilesSplit = $element.Split("=") [string]$MacFromArray = $TextFilesSplit[0] [string]$ComputerNameFromArray = $TextFilesSplit[1] $MacFromArray = $MacFromArray.Trim(" ") $ComputerNameFromArray = $ComputerNameFromArray.Trim(" ") if($MacAddress -eq $MacFromArray){ $OSDComputerName = $ComputerNamefromArray } { $TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment $TSEnv.Value("OSDComputerName") = "$OSDComputerName" } This is what the log file says Running powershell script: 'OSDComputerName.ps1'(PkgID: BFM000E5) with execution policy: 'Bypass' RunPowerShellScript 2019-08-23 09:11:47 2788 (0x0AE4) Filesystem::File::Exists( sPowerShellPath.c_str() ) == true, HRESULT=80070490 (main.cpp,345) RunPowerShellScript 2019-08-23 09:11:47 2788 (0x0AE4) PowerShell.exe does not exist at 'X:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe' RunPowerShellScript 2019-08-23 09:11:47 2788 (0x0AE4) ExecutePowerShellScript(sScriptName, sParameters, sPackageID, sExecutionPolicy, sOutputVariableName, dwPSRunExitCode), HRESULT=80070490 (main.cpp,876) RunPowerShellScript 2019-08-23 09:11:47 2788 (0x0AE4) Run PowerShell script failed to run, hr=0x80070490 RunPowerShellScript 2019-08-23 09:11:47 2788 (0x0AE4) Process completed with exit code 2147943568 TSManager 2019-08-23 09:11:47 1040 (0x0410) And I'm trying to run it like the attached. Quote Share this post Link to post Share on other sites More sharing options...
0 Joe13 Posted August 23, 2019 Report post Posted August 23, 2019 Enabled PS on boot image. Will test this now. Quote Share this post Link to post Share on other sites More sharing options...
Hi all, I need some help and it might be something easy. I have no scripting skills and tried various methods on the internet but it's not working.
All I want is for the TS to ask me what computer name I want for the deployment, some sort of popup.
Share this post
Link to post
Share on other sites