Decrypt powershell secure string

#create secure string
$secure = read-host “enter password” -assecurestring
$secure2 = convertto-securestring -string ‘P@$$w0rd’ -AsPlainText -Force
$credential = Get-Credential

#view credential
$credential | gm
$credential.UserName
$credential.Password

#bypass and view true credential
$credential.GetNetworkCredential()
$credential.GetNetworkCredential() | fl *
$credential.GetNetworkCredential().password

#decrypt secure string \ or credential ($credential.Password)
$marshal = [System.Runtime.InteropServices.Marshal]
$ptr = $marshal::SecureStringToBSTR( $secure )
$str = $marshal::PtrToStringBSTR( $ptr )
$marshal::ZeroFreeBSTR( $ptr )
$str

#delete variable and load .NET garbage collector
del variable:\secure
[gc]::Collect()
Set-ExecutionPolicy Bypass -Force
Set-ExecutionPolicy Unrestricted -Force
Get-ExecutionPolicy -List

 

 

http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/26/decrypt-powershell-secure-string-password.aspx

 

http://blogs.msdn.com/b/besidethepoint/archive/2010/09/21/decrypt-secure-strings-in-powershell.aspx

Decrypt powershell secure string

C# how to – list url

SPSite site = new SPSite(“http://len-shareappt”);

SPWeb web = site.OpenWeb();
SPList list = web.Lists.TryGetList(“Валидация полей”);
list.AllowDeletion = true;
list.Update();
string webUrl = web.Url;
Console.WriteLine(SPUtility.GetFullUrl(site, webUrl));
Console.WriteLine(list.RootFolder.Url);
Console.WriteLine(list.ParentWeb.Url);
Console.WriteLine(list.RootFolder.ServerRelativeUrl);
Console.ReadLine();

 

SPUtility.GetFullUrl(site, webUrl)
http://len-shareappthttp://len-shareappt

list.RootFolder.Url
Lists/RequestFieldValidation

list.ParentWeb.Url
http://len-shareappt

list.RootFolder.ServerRelativeUrl
/Lists/RequestFieldValidation

C# how to – list url