.net 如何使用不是 SystemSecuredString 的密码创建新的 PSDrive?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13818751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I create a new PSDrive by using a password that is not SystemSecuredString?
提问by pencilCake
Is there a way to create a New-PSDrive by using a password that is a NON- SystemSecured string ?
有没有办法通过使用非 SystemSecured 字符串的密码来创建新的 PSDrive?
If the password is "FooBoo" I want to use it as it is...
如果密码是“FooBoo”,我想按原样使用它......
回答by Lo?c MICHEL
just use the old net use commmand
只需使用旧的网络使用命令
PS>net use z: \server\share Fooboo /user:domain\user
PS>Get-PSDrive -Name Z
Name Used (GB) Free (GB) Provider Root CurrentLoc
ation
---- --------- --------- -------- ---- ----------
Z 150,36 49,64 FileSystem Z:\
Or convert you plain text password to secure-string :
或者将您的纯文本密码转换为 secure-string :
PS>$pass="FooBoo"|ConvertTo-SecureString -AsPlainText -Force
PS>$Cred = New-Object System.Management.Automation.PsCredential('user@domain',$pass)
PS>New-PSDrive -name j -Root \server\share -Credential $cred -PSProvider filesystem
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
j FileSystem \server\share

