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

How to Format a list to be emailed?

With a number of searches I've put together a script that will email me a list of empty directories on our SAN. The email works, and sends me a rather ugly list on one line: \\sann\rdb$\RDT00437...

View Article


Reply To: How to Format a list to be emailed?

To answer your question, you are creating a string doing the for loop: ForEachObject{$_.FullName} Have you looked at using HTML reporting? Don Jones put together a free e-book on it and there are...

View Article


Reply To: How to Format a list to be emailed?

The Body parameter of Send-MailMessage (or property of the MailMessage class, in this case) takes a String, and you're passing it an Array. Arrays, when automatically converted to strings, are...

View Article

Reply To: How to Format a list to be emailed?

Great! Thank you, Dave and Rob. Simple is best for this little weekly report.

View Article

Composite Configuration Best Practices

I want to try and use DSC to configure 3 different web farms with about 100 Websites. The web farms will all have the same IIS features installed, and the same SSL certificates (probably Centralized...

View Article


Reply To: Composite Configuration Best Practices

Also, side note. Can you loop through things in your configuration? So instead of: # Install the IIS role WindowsFeature IIS { Ensure = "Present" Name = "Web-Server" }   # Install the ASP .NET 4.5...

View Article

Installing features the require reboot before continue

Has anyone experience installing a feature (using the feature resource) that requires a server restart before continuing on with the rest of the configuration (e.g. web-mgmt.-console)

View Article

Reply To: Installing features the require reboot before continue

Yup. I usually set auto-reboot to True before starting a big config like that.

View Article


Reply To: Composite Configuration Best Practices

That sounds like a reasonable approach. We don't really have "best" practices yet – you gotta try stuff and let us know how it works ;). And yeah, you can have logic in the config – but remember, that...

View Article


Reply To: Problem setting up dsc

Yeah, I'm not seeing it either. Wondering if you've got a goofed system.

View Article

Reply To: Installing features the require reboot before continue

Will that work for both push/pull Where do you set this in a LocalConfigurationManager section in the configuration script?

View Article

Reply To: Installing features the require reboot before continue

It's the RebootNodeIfNeeded setting. Run Get-DSCLocalConfigurationManager; you'll see the setting.

View Article

Reply To: Problem setting up dsc

Maybe try deleting all the modules and re-installing them? If you are using WMF 5.0 preview I would maybe try installing it using Find-Module and Install-Module. Find-Module | Where-Object Name -like...

View Article


Reply To: Problem setting up dsc

Hmm – this is repeatable and is happening on newly installed Server 2012 R2 w/update 1 boxes freshly created. I will try to add WMF5 and see what good that does.

View Article

Variable Output in Email

$listmanagers = Get-ADUser -Filter * -SearchBase "OU=Non Employees,OU=Users,OU=Accounts,DC=Contoso,DC=com" -Properties Manager| where-object { $_.manager -ne $null} | %{(Get-AdUser $_.Manager)} |...

View Article


Reply To: Variable Output in Email

You have a couple of options. $managername is a object containing the name. So you can do either expand the property to return a string: $managername = get-aduser $listmanager | select-object...

View Article

Reply To: Variable Output in Email

Use Select-Object's -ExpandProperty parameter, instead of -Property (which is what you are using when you pass arguments positionally): $managername = get-aduser $listmanager | select-object...

View Article


Reply To: Variable Output in Email

If you do try to expand an object's property inside a string, make sure to use the subexpression operator $(). This won't work: $body =" Dear $managername.name," But this will: $body =" Dear...

View Article

Reply To: Variable Output in Email

Thanks for the correction Dave. Also, you should take a look at here-strings if you are going to be compiling a message to the user for ease of formatting: $managername = Get-ADUser jsmith | Select...

View Article

Windows Feature Installs that Require Reboot

After fooling around with this for a while I've discovered the following the settings: RebootNodeIfNeeded = $true Does not work if you are running the configuration script on the machine being...

View Article
Browsing all 13067 articles
Browse latest View live