Are you an IT Pro?
 Are you interested in information technologies?
  Technology Stronghold is the right place for you!

PowerShell Windows User Group event for DevOps - September 2015 in Czech

I would like to thank you very much for attending our PowerShell Windows User Group (WUG) event.

Current event: PowerShell for DevOps aka PowerShell Hidden treasures (Czech language)

Btw. did you know that Jeffrey Snover (@jsnover) is the Mother of PowerShell?

Read More

How to stop (terminate) processes on a remote server using PowerShell and CIM / WMI?

My friends asked me simple question: How to stop (terminate) processes on a remote server?

Of course you can use:

Invoke-Command -ComputerName RemoteServer

or

Invoke-Command -Session $existingSessionToRemoteServer

But in this case my friends had established CIM session in their script. I wrote a few simple examples how to stop process using WMI and CIM and if you add -ComputerName (for Get-WmiObject) or -CimSession (for Get-CimInstance) then you can do it on a remote server.

WMI on …

Read More

PowerShell - Script to run one-time full deduplication including optimization, garbage collection and scrubbing

I wrote a simple script to run full deduplication. It is handy when you need one-time deduplication including garbage collection and scrubbing job.

$ErrorActionPreference = 'Stop'

Function Wait-RvDedupJob

{

Write-Warning -Message 'Wait for all jobs to finish'

while (Get-DedupJob -ErrorAction SilentlyContinue)

{

Start-Sleep -Seconds 10

}

}

Get-DedupVolume | ForEach-Object -Process `

{

$_.Volume

Wait-RvDedupJob

$_ | Start-DedupJob -Type …

Read More

How to setup Debug Mode in Windows PowerShell Desired State Configuration (DSC)

If you work on custom DSC resources then debug mode is very handy for you because you may need to re-import your updated DSC resource again and again. Without re-import (force import) the DSC uses cache.

How to set DebugMode:

None

Signifies that DebugMode is False and not applicable.

ForceModuleImport

Enforce the resource module to be reloaded instead of using the cache. This is similar to "true" value in previous versions.

ResourceScriptBrealAll

Helps in debugging DSC …

Read More

How to remove all PowerShell DSC configuration documents (MOF files)?

Recently I got question from one developer that uses DSC about DSC configuration documents (MOF files) that are used for current configuration and he did not believe me that MOF file for current configuration is just a file in C:\Windows\System32\Configuration directory.

I would like to present you a simple piece of code that shows you MOF files and process how to remove them. It is possible to remove them using cmdlet Remove-DscConfigurationDocument or you can simply delete them. Remove- …

Read More