how to get reference of a powershell variable in another powershell script


hi team,

please let me know how reference of powershell variable in powershell script

test1.ps1

$variable1 = "testmessage"

test2.ps1

how reference of $variable1 in test2.ps1

 

1)use scropes

$script:variable1 =  "testmessage"  or $global:variable1 =  "testmessage" 

for more inform - get-help about_scopes

2) pass parameter

3) dot sourcing

http://technet.microsoft.com/en-us/library/ee176949.aspx#ecaa




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client