Powershell MessageBox


hi,

i add messagebox in powershell script.

i have 2 scripts, first launch script specific credentials.

first script :

start-process powershell -argumentlist "c:\scripts\script1.ps1" -credential (domain\user)

in second script use messagebox :

[system.windows.forms.messagebox]::show("test messagebox" , "information")

when run first script, have error : 

unable find type [system.windows.forms.messagebox]: make sure assembly containing type loaded.

i run command : add-type –assemblyname system.windows.forms but have same error.

if run second script, don't have error.

how can fix this?

thanks.




add-type –assemblyname system.windows.forms - add command top of c:\scripts\script1.ps1

same error.


try add command  to second script.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B