PowerShell stupidity...

home | blog | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts


- Careful Chrome users, this search box might be "Not secure"



Latest run in with PowerShell - feel the hate.
So, I needed to change a users MS364.7528 principal name due to a marriage.
Simple matter, as I am sure they have it in the web interface?
No.... Powershell script time again.
Ok, just run it?
No, here is what you do-
Download 2 pre-requisites.
Run script
Find first error - 
Get more patch items (lots of searching for sane answer from the crap answers)
Run scripts - reboot 3 times.
Run script again - login error
Update .Net to bleeding edge release 'case MS364.7528 broke the library.
Run the script again - and finally success.
Total time - only 1.5 hours for the convenience of using an MS supplied script!


Getting this error?: execution of scripts is disabled...
Should that not be "are"? Bad engrish!
If you get an error when trying to run a PS1 script like this:
... execution of scripts is disabled on this system.

Give this a try:
set-executionpolicy remotesigned

Or if you are daring on a toy OS as Administrator:

set-executionpolicy unrestricted

Of course you need to do the runas administrator for starting the ps session.
More PS stuff: - broken Azure sync script
If you found that the PS1 Azure sync script move on ya, give this a try...
Runas administrator "Windows Powershell..."

cd '.\Program Files\Windows Azure Active Directory Sync\DirSync'
.\ImportModules.ps1
Import-Module dirsync
Start-OnlineCoexistenceSync

On error goto article above :-)
PS is some wacky stuff, just check this out;
https://medium.com/@octskyward/the-woes-of-powershell-8737e5346b1#.2kpw9k4hr
Convert SID to some sort of name-
$objSID = New-Object System.Security.Principal.SecurityIdentifier ("S-1-5-21-1234567890-toomuchtyping-moretyping-1234")
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$objUser.Value

Install Windows Server Backup on Server 2016
Thanks Jerod: https://www.rootusers.com/how-to-backup-windows-server-2016/
In case that goes away:
(Search for what it might be called in this version of Windows :-)
Get-WindowsFeature -Name *Backup*
(Actually install it):
Install-WindowsFeature -Name Windows-Server-Backup

Check what sources are being used by Windows Update:
cmd.exe /c echo . | powershell.exe -ExecutionPolicy Bypass -command "$ServiceManager = New-Object -ComObject 'Microsoft.Update.ServiceManager';$ServiceManager.Services"



[æ]