Hi,
I’m a bit stuck with a fct which is part of a larger script to update a software.
function Lock-user { [CmdletBinding()] param( [String]$RemoteMachine ) #$RemoteMachine = "localhost" Write-Verbose "Lock-User Enter for $RemoteMachine" $Scriptblock={ $wshell = New-Object -ComObject Wscript.Shell $wshell.Popup("Do you want to update charlemagne Software ? `n`n Note : This will close all active instances",3,"Mise a jour de Charlemagne",0x1) #C:\windows\system32\msg.exe * "Mise a jour de Charlemagne. `n`n Note : cela va fermer toutes les instances active" if($? -eq 1 -or $? -eq -1){ if (Get-Process -Name Administratif -ErrorAction SilentlyContinue){ (Get-Process -Name Administratif).kill()} } }#end Scriptblock Invoke-Command -ComputerName $RemoteMachine -ScriptBlock $Scriptblock }#End Lock-user
Is it Possible to specify which user will receive the popup with $wshell.Popup if not how can i recover the ok button value for msg.exe
Thanks for taking the time to review.
CM