Search This Blog

PowerShell: Avoid Bank Lines at End of a Text File

Use System.IO.File .NET Framework class’s Write AllText static method.

[System.IO.File]::WriteAllText(string path, string contents)

or [System.IO.File]::WriteAllText(string path, string contents, System.Text.Encoding encoding)

e.g. [system.io.file]::WriteAllText(“c:\fso\ioascii.txt”, $count, [System.Text.Encoding]::ascii)

More info: [system.io.file] | get-member –static WriteAllText | fl *

[system.text.encoding] | get-member –static –MemberType property

Reference: http://blogs.technet.com/b/heyscriptingguy/archive/2011/09/19/avoid-blank-lines-at-end-of-a-text-file-with-powershell.aspx

Best Practices for DNS Client Setting in Windows Server Domain Controller with DNS Installed

Assume at least two domain controllers with DNS installed in the domain.

  • Configure the remote DNS server set as Preferred DNS server
  • Configure 127.0.0.1 as Alternate DNS server

Reference:

PowerGUI Script Editor Add-ons

  • Script Editor Essentials: add View White Space, Word Wrap and Virtual White Space menu items to the Edit | Advanced menu …
  • ExpandAlias: expand aliases in the code pane to the full cmdlet name.
  • Script Template: insert a header for new documents.
  • PShellExec: secure/encrypt scripts and execute them right inside the editor

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...