VMWare: VUM not working after migration?

Try this : https://kb.vmware.com/s/article/2147284

Powershell : File generation

  1..5 | % { New-Item -Path c:\fso -Name “$_.txt” -Value (Get-Date).toString() -ItemType file} Borrowed from : here

Powershell : WinSCP

WinSCP has a series of inbuilt libraries to help keep a remote site synchronised with a local site. You will need WinSCP (obviously) and winscp.ino as well as WINSCPnet.dll. I adapted the code a little more than listed here, but the premise is the same. function Sync { param ( # Use Generate URL function […]

Powershell : changing Remote Desktop Home Folders.

In my last blog I posted about finding the Remote Desktop Home Folders. Best now post how to change them … Function Set-RDUserSetting { [cmdletbinding(SupportsShouldProcess)] Param( [Parameter(Position=0,Mandatory,HelpMessage=”Enter a user’s sAMAccountName”, ValueFromPipeline,ParameterSetName=”SAM”)] [ValidateNotNullorEmpty()] [Alias(“Name”)] [string]$SAMAccountname, [Parameter(ParameterSetName=”SAM”)] [string]$SearchRoot, [Parameter(Mandatory,HelpMessage=”Enter a user’s distingished name”, ValueFromPipelineByPropertyName,ParameterSetName=”DN”)] [ValidateNotNullorEmpty()] [Alias(“DN”)] [string]$DistinguishedName, [boolean]$AllowLogon, [Alias(“Profile”)] [string]$TerminalServicesProfilePath, [Alias(“HomeDirectory”)] [string]$TerminalServicesHomeDirectory, [Alias(“HomeDrive”)] [string]$TerminalServicesHomeDrive, [string]$Server, [switch]$Passthru ) […]

Powershell : Finding Remote Desktop Home Folders.

I am working on a project to migrate a Windows Cluster. I need to find any AD accounts that are pointing to the older cluster location in Remote Desktop Services Home Folder.   I have pilfered this code from the interwebs : https://www.petri.com/powershell-problem-solver-active-directory-remote-desktop-settings   [code language=”powershell”] Function Get-RDUserSetting { [cmdletbinding(DefaultParameterSetName=”SAM”)] Param( [Parameter(Position=0,Mandatory,HelpMessage=”Enter a user’s sAMAccountName”, ValueFromPipeline,ParameterSetName=”SAM”)] […]

Powershell ( PowerCLI tools installed ) query for VMWare tools

Simple but effective crawler for checking which vmtools are “current” Easy to modify if you want to find those that are out of date , change -eq to -ne Connect-VIServer FQDN of VCenter Get-VM | Where-Object {$_.ExtensionData.Guest.ToolsStatus -eq “toolsOk”} >> c:\temp\SomeFileName.txt

Reset Admin Password in Windows 2012 without logging on

Instructions To reset the password on your Windows 2012 server, simply complete the following steps: Boot from the Micrsoft Windows Server 2012 DVD From the Windows Setup menu, click “Next”. Select “Repair your computer” Under Choose and option, click on “Troubleshoot”. Under Advanced options, click “Command Prompt”. At the command prompt, run the following commands: d: cd windows\system32 ren […]

RAID calculator IOPS tool

Great RAID calculator IOPS tool : https://www.expedient.com/disk-raid-and-iops-calculator/

WSUS6.x Cannot open database “SUSDB” requested by the login. The login failed.~~Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

Are you receiving Cannot open database “SUSDB” requested by the login. The login failed.~~Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’ ?   Easy fix : Remove KB3159706 More complicated fix : https://support.microsoft.com/en-us/help/3159706/update-enables-esd-decryption-provision-in-wsus-in-windows-server-2012-and-windows-server-2012-r2

Powershell : Adding a GUI for a silent installer.

Seems counter intuative , right ? Customer needs a pop up to display that software is being installed and offer the delay action. CM2012 could be used but it needs to be clear and simple for the (ab)users. This happens to be for a SAP silent install , but the theory will work for all […]

Moving Windows 2008r2 Cluster Shares without DFS

You can move Windows 2008r2 cluster shares without the need for DFS. It goes a little something like this Data copy I used emcopy to move all data from the existing sahre to the newly added share as it copies all and sundry. Quickly. Ill not go through these steps.   Adding Disk to services […]

SCCM Collection for things that arent installed

This is crazy , you need to find a piece of software that isnt installed on your empire.   Try this :   https://blogs.technet.microsoft.com/jchalfant/collection-of-computers-missing-an-application-software-title-in-configuration-manager/

SCCM Log files.

Ever wondered what the myriad of log files do ? Wonder no more ! https://technet.microsoft.com/en-gb/library/hh427342.aspx Here is a great breakdown of the above information : https://blogs.msdn.microsoft.com/lxchen/2009/04/03/a-list-of-sccm-log-files/    

Stored passwords

try this in CMD : rundll32.exe keymgr.dll,KRShowKeyMgr   Shows all your stored credentials.

Powershell : Remove logon scripts

Removes logon scripts on a particular OU. $path = [adsi]”LDAP://OU=Users,OU=IT,OU=Eu,DC=eu,DC=somewhere,DC=com” $obj = New-Object adsisearcher($path , “(scriptPath=*)”) $users = $obj.FindAll() foreach ($user in $users) { $user = [adsi]$user.path $user.PutEx(1,”scriptPath”,$null) $user.SetInfo() }

Powershell stop and restart multiple KDC

Powershell stop and restart multiple KDC We had a requirement to stop and restart the KDC on multiple remote DCs. Rather than go around each one , we wrote a script . function DateAndTimeLog { Get-date } function testIf { If (Test-Connection -comp $dc -count 1 -quiet) { $dc+” is online! ” } Else { […]

Powershell documentation of environment

go here !   Scripts and Other Utilities

WMIC Serial number

Everyone loves a bit of WMIC.   How about this one to discover your serial number ?   Open CMD wmic bios get serialnumber

VMWare 6 / Vsphere

http://featurewalkthrough.vmware.com/#!/vsphere-6-0   The above is a really useful feature and guide from VMWare

Powershell : Find all active users who havent logged in

Request from a customer. Find me all active ( IE not disabled ) users in a particular OU who have never logged in. “I have a powershell for that” appears to be the default answer for most queries these days … Get-ADUser -Filter {enabled -eq $true} -SearchBase “OU=Eu,DC=eu,DC=notyou,DC=com” -Properties “LastLogonDate” | sort-object -property lastlogondate -descending […]

Powershell : remote machines static dns to DHCP

This will read an input file , and using the WMI object change any statically assigned DNS to DHCP.   # grabs the ListofMachines from the CSV $ListofMachines=Get-Content “c:tempmachines.csv” # loop starts here foreach ($machine in $ListofMachines) { #Performs a release ( if needed ! use with care remotely ! ) #Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName […]

Powershell : renew multiple machines DHCP scopes

# grabs the ListofMachines from the CSV $ListofMachines=Get-Content “c:tempmachines.csv” # loop starts here foreach ($machine in $ListofMachines) { #Performs a release ( if needed ! use with care remotely ! ) #Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $machine | Where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true} | ForEach-Object -Process {$_.ReleaseDHCPLease()} # query the $machine that […]

Powershell : renew remote IP address

We wrote this at GiraffeIT.com. If you know the remote IP or DNS name of a machine it will help you renew a DHCP lease and flush the DNS. Very useful if you have a remote machine with a scope change and its not being reflected.   write-host “—————————–” write-host “DHCP lease renewal + flushDNS” […]

Powershell – logon script based on username

Devised this script that will run a program based on the username of the logged in user and resizes the window as needed.   #find the currently logged on user and stick the name into the $LoggedOnUser variable $LoggedOnUser=(Get-WmiObject -Class Win32_Process | Where-Object {$_.ProcessName -eq ‘explorer.exe’}).GetOwner() | select User echo $LoggedOnUser #Uncomment the line below […]

Powershell : export-dhcpserver

Export/Import existing scopes   Export the DHCP scope ( whilst leaving active on source ) from SERVER using either powershell or netsh   Powershell commands:   Export-DhcpServer [-File] <String> [-CimSession <CimSession> ] [-ComputerName <String> ] [-Force] [-Leases] [-Prefix <IPAddress[]> ] [-ScopeId <IPAddress[]> ] [ <CommonParameters>]   Example: export-dhcpserver -ComputerName SERVER -file “C:PATHNAME.XML” Pre-Requisites for the PowerShell at […]

Powershell: backup all DHCP servers

This script MUST be run on a 2012 server #you define some share ( eg \server1dhcpbackup$  , and DNS suffix eg my.domain.com #remove any variables that might have been stored, otherwise it has a bit of a wobble. Remove-Variable dhcpServer Remove-Variable dhcpServers #we are going to do a check first for all files/folders that are […]

Powershell : Ping all machines

In theory you should know if all your machines are active or not in your environment. However as the environment gets bigger or more people work on it this can become confusing. This powershell script reads a list ( in txt format ) of machines you want to ping , how many pings , max […]

Powershell : Find all servers in a domain

This code will find all servers in a domain and return its canonical location   $objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.Filter = ‘(OperatingSystem=Window*Server*)’ “Name”,”canonicalname”,”distinguishedname” | Foreach-Object {$null = $objSearcher.PropertiesToLoad.Add($_) } $objSearcher.FindAll() | Select-Object @{n=’Name’;e={$_.properties[‘name’]}},@{n=’ParentOU’;e={$_.properties[‘distinguishedname’] -replace ‘^[^,]+,’}} | ft -autosize

Powershell : add users from one group to another.

Simple script to add multipe users from one group to another easily.   Will show on screen error if they already are members of the destination group but carry on going on error.     ====================================================================================== $Source_Group = “CN=MAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com” $Destination_Group = “CN=newMAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com”   $Target = Get-ADGroupMember -Identity $Source_Group foreach ($Person in $Target) { […]

Powershell export virtual machines IP

This script is pretty handy, it will connect to the Virtual Center you specify in Powershell.   # you will need to adjust the viserver name connect-viserver mecvm01.eu.kellogg.com $reportedvms=New-Object System.Collections.ArrayList $vms=get-view -viewtype virtualmachine |Sort-Object -Property { $_.Config.Hardware.Device | where {$_ -is [VMware.Vim.VirtualEthernetCard]} | Measure-Object | select -ExpandProperty Count} -Descending foreach($vm in $vms){ $reportedvm = New-Object […]