Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: new-aduser error

Short answer is using Read-host in the way that you do. I would either just type in the values, or turn your code into a simple function or create a csv file with the data and pass that to New-AdUser

View Article


Reply To: new-aduser error

Depends on what you typed in for the “Name” prompt, I think. (Path might be involved as well.)

View Article


Reply To: new-aduser error

By the way, this is the preferred way to prompt for input if a parameter hasn’t been passed in to your script. When you mark everything as Mandatory, the PowerShell engine takes care of that for you...

View Article

Reply To: new-aduser error

can you give me an example to a simple function? why shouldn’t i use “read-host” Thanks

View Article

Reply To: Running PSexec from powershell

psexec \\(gc .\computers.txt) -u doamin\user -p p@ssword -h -d powershell.exe “Get-Process”

View Article


Reply To: Running PSexec from powershell

(gc .\computers.txt) | foreach { psexec \\$_ -u doamin\user -p p@ssword -h -d powershell.exe “net localgroup users” }

View Article

Reply To: new-aduser error

$FileToImport = “C:\NewHires.csv” import-csv $FileToImport |ForEach-Object { New-QADUser -name $_.name -FirstName $_.FirstName -LastName $_.LastName -SamAccountName $_.Samaccountname -Email $_.email`...

View Article

Reply To: Module Manifest Help

Is there a way to load the sqlps module with disable name checking enabled but keeping the sqlps module local to my modules scope. - You could load the module from within your script module. That’d...

View Article


Reply To: new-aduser error

Read-Host is very inflexible. It just prompts you to enter something and that’s it. However, parameterizing your one-liner, as Dave did, has many advantages. It makes your script look and act like a...

View Article


Reply To: new-aduser error

I don’t get what am I doing wrong with code formatting? I use the code tags and the formatting just gets ugly. On wordpress.com you can use [code language="powershell"][/code] and it works...

View Article

Reply To: Module Manifest Help

Don thanks for taking the time to answer my question, everything worked as you suggested. I think that I will leave the sqlps import where it is, otherwise remove-module MyModule will not remove sqlps...

View Article

Reply To: new-aduser error

<div class=”d4p-bbp-quote-title”>Istvan Szarka wrote:</div>I don’t get what am I doing wrong with code formatting? I use the code tags and the formatting just gets ugly. On wordpress.com...

View Article

Reply To: new-aduser error

I don’t know. But Dave’s script is formatted alright, I wonder how does he do that.

View Article


Reply To: new-aduser error

For simple stuff, you can use PRE tags instead of CODE. If you need to post code with backticks, or embedded strings that look like HTML, I use a PowerShell function to escape the code before posting....

View Article

Reply To: Deploying PowerShell v3

This is a VBscript that I used to use when getting Powershell out to my clients. I have ConfigMgr so I deployed it that way but this could just as easily be put into a login/startup script or some...

View Article


Reply To: Splatting in script

My first guess would be to remove the double quotes from your parameters that specify a variable.

View Article

Reply To: Running PSexec from powershell

Rather than depending on psexec, I'd use the [ADSI] type accelerator or WMI to get this information. I'm thinking something like this great post –>...

View Article


Reply To: Splatting in script

I tried, didn't help. I also tried with semicolons between the parameters, but got the same errors. The VHD gets created alright, but not the VM. I've searched the internet for every possible way of...

View Article

Reply To: Remote Service commands – multiple services/servers?

[code language="powershell"] Get-Content E:\Powershellscripts\DisableTheseServices.txt | Set-Service -StartupType Disabled -Verbose [/code]

View Article

Reply To: looking for guidance regarding html reporting

im sorry for the confusion. let me try to clarify. im looking to have "feedback" regarding lets say… installing an application(via msi) in a script.(keep in mind this script is running against a list...

View Article
Browsing all 13067 articles
Browse latest View live