Disable UAC for administrator using Powershell

Commandline configurations are my favorited. They are very usefull to be used in standard Configuration scripts. This evening I stumbled across this one and wanted to share it. The command uses the registry to perform the change. This allows also other configurations to be injected. My life just got a little bit easier once again…

Set-ItemProperty -Path registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -Value 1

PowerShell script reboot check

Today, I received a mail notification that a given server is not available anymore. The error was sent around 6:10 in the morning. The server is a management server not managed by our team.

To decrease the time required if the reboot was caused by Windows updates (which was the reason in the past), I quickly wrote a little PowerShell script to determine the cause.

PS C:\Users\rur> Get-EventLog -LogName System -after (get-date).addhours(-48) | where {($_.EventId -eq 1074) -or ($_.EventId -eq 22)} | select TimeGenerated,EventId,Message | format-table -wrap -autosize

Continue reading

Abort an unresponsive Data Protector job

Sometimes aborting a job by using the Data Protector Manager Console does not succeed.
In those situation, follow this procedure:

  • Go to the Data Protector Manager console > Monitor > Session-Id and take a not of the start time.
    [Normal] From: BSM@CellManager.lab.local “FILE_DAILY” Time: 5/23/2013 4:15:05 AM
    Backup session 2013/05/23-13 started.
  • Open a PowerShell Window and execute the following command: “get-process b* | sort-object StartTime | format-table Name,Id,StartTime”
    Name Id StartTime
    —- — ———
    bsm 8532 18/05/2013 4:15:07
    bsm 8996 19/05/2013 5:15:05
    bsm 11672 23/05/2013 4:15:05
  • Execute the following command to kill the process: “stop-process 8532“.

Execute the command “omnistat” or “get-process b* | sort-object StartTime | format-table Name,Id,StartTime” to verify the operation. Restart the Data Protector Management console to clear the monitor in the GUI.

PowerCLI – list virtual machines with physical SCSI controllers & inventory path within vcenter

For a project, we needed to implement a VEEAM Backup & Replication setup. During the project we encountered some virtual machines with Physical RDMs. VEEAM cannot handle this, so it was needed to write a script allowing us to list all virtual machines with their most interesting parameters, such as:

  • Virtual Machine Name
  • Version
  • PowerState
  • HardDisks
  • ProvisionedSpaceGB
  • Datacenter
  • Cluster
  • InventoryPath
  • HasPhysicalController

The function Get-VMFolderPath can be found on this blog.

Continue reading