Skip to content

Instantly share code, notes, and snippets.

View jespernohr's full-sized avatar

Jesper Nøhr jespernohr

View GitHub Profile
Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.ServerCmdlets.dll" Invoke-StorageSyncFileRecall -Path <path-to-to-your-server-endpoint>
$cred = Get-Credential
$s = New-PSSession -ComputerName server1.contoso.com -Credential $cred
#Copy files to server
Copy-Item -ToSession $s -Path C:\test\test.txt -Destination D:\Test\
#Copy files from server
Copy-Item -FromSession $s -Path C:\Temp\test.txt -Destination C:\test\
PSEdit C:\inetpub\wwwroot\iisstart.htm
$env:Path += ";C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"
choco install azcopy -y
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
Enter-PSSession -ComputerName <IP, DNS or FQDN> -Credential (Get-Credential)
#Scan for available updates
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession 
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=0";OnlineScan=$true}
$result.Updates
#Install all available updates
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
Invoke-CimMethod -InputObject $ci -MethodName ApplyApplicableUpdates
Restart-Computer; exit
2016.12.04 07:00 Info: --- CDP 0 ---
2016.12.04 07:00 Info: [0] Begin CRL Check of http://crl.fabrikam.com/crl/Fabrikam%20Issuing%20CA.crl
2016.12.04 07:00 Info: [0] CRL Download via DNS Lookup
2016.12.04 07:00 Info: [0] CRL Downloaded Complete
2016.12.04 07:00 Info: [0] Beginning Freshness Checks
2016.12.04 07:00 Success: [0] Fresh - Expires in 136 hours
2016.12.04 07:00 Info: [0] Finish CRL Check of http://crl.fabrikam.com/crl/Fabrikam%20Issuing%20CA.crl
2016.12.04 07:00 Info: --- CDP 1 ---
2016.12.04 07:00 Info: [1] Begin CRL Check of https://example.blob.core.windows.net/crl/Fabrikam%20Issuing%20CA.crl
2016.12.04 07:00 Info: [1] CRL Download via DNS Lookup