Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Using Powershell to set static passwords

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-01-2008   #1 (permalink)
John Christie
Guest


 

Using Powershell to set static passwords


I'm using the following to create bulk create mailbox enabled user accounts
from a CSV.

$Password = Read-Host “Enter Password” -AsSecureString

import-csv user1.csv | foreach {New-Mailbox -name $_.Name -sAMAccountName
$_.sAMAccountName -UserPrincipalName $_.UPN -database "EXC01\SCCCS\SCCCS
Database" -Password $Password -OrganizationalUnit "test.local/SCC"
-ResetPasswordOnNextLogon:$true }

At the moment, I have to manually type in the password before running the
import.

Is it possible to assign a static password without having to manually enter
it....so have the password set from within the CSV?

I'm trying to automate the whole thing but can't figure out how...

JC

My System SpecsSystem Spec
Old 07-01-2008   #2 (permalink)
sapienscripter's Avatar
Scripting Guru


Join Date: Jun 2008
Vista Ultimate 32bit
Syracuse, NY
 
Rep Power: 8
sapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura about
  sapienscripter is offline

Re: Using Powershell to set static passwords

I believe that method requires a secure string for the password. As long as you know the risks of hardcoding passwords, this might get you around using Read-Host

#create the plain text password string
$s="IAmASecureString"
#create a securestring object
$pwd=new-object system.security.securestring
#add the plain text string to the secure string
$s.toCharArray() | foreach {$pwd.AppendChar($_)}
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Static Events Used By Static Classes Mike .NET General 7 03-05-2008 01:42 PM
how to call a static method in a .net class from powershell? YY PowerShell 1 09-11-2007 12:51 AM
Access a static member on a nested static class. matthew.ashton@gmail.com PowerShell 3 02-28-2007 08:43 AM
Access a static member on a nested static class. matthew.ashton@gmail.com PowerShell 0 02-28-2007 04:27 AM
NTLM Passwords Linux NAS passwords SteveK Vista networking & sharing 5 02-02-2007 12:14 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51