Category Archives: Powershell

Powershell: Generate a GUID

Hi,

to create a GUID in powershell for the use in your own scripts call the static function NewGuid() from the system.Guid class.

PS D:\> [system.Guid]::NewGuid()
f3f8591a-c1d6-4d82-bec2-d3dac2c1fee5

Michael

Advertisment to support michlstechblog.info

Powershell: Write XML files with UNIX line endings

Hi,

if you want to create XML files with powershell which can be used on UNIX/Linux systems you need to write an own save function. Ths save() methode of the System.XML.XMLDocument class can only write Windows style XML files with Carriage return/New line endings.
Continue reading Powershell: Write XML files with UNIX line endings

Powershell: Customize the prompt

Hi,

the default prompt of the powershell is “PS” and the current working directory:
Continue reading Powershell: Customize the prompt

Powershell: Run a (init) script when powershell starts

Hi,

if have some own aliases or functions defined which should be loaded when powershell starts you can create a startup script.
Continue reading Powershell: Run a (init) script when powershell starts

Windows: Working with the powershell command history

Hi,

like the UNIX bash shell, the Windows powershell also has a history which commands were executed.

Continue reading Windows: Working with the powershell command history