Tag Archives: powershell

Pass arguments to the PowerShell script in PowerShell ISE

Use the command pane. Open the script file in the ISE editor, set the breakpoints (F9). Then in the command pane type a command invoking this script with required parameters. I do not think there is another (built-in) way of … Continue reading

Posted in develop | Tagged , , | Leave a comment

PowerShell Culture and Help

https://powershell.org/forums/topic/invoke-command-remove-pscomputername/ https://powershellserveradmin.wordpress.com/2015/01/09/get-help-vs-help/ https://social.technet.microsoft.com/Forums/Lync/en-US/dea5d51d-0757-4916-86d8-c0b12ef55153/how-to-exclude-property-from-result-returned-by-powershell-command-?forum=sharepointadminprevious Aliases https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/01/best-practice-for-using-aliases-in-powershell-scripts/ PowerShell session culture https://p0w3rsh3ll.wordpress.com/2012/01/22/working-with-system-locale-and-user-locale/ ## Test remote PS call from JACK on RHINO $computerName = “lsc561.tw.ibm.com” $remoteUser = “Administrator” $remotePassword = “!Sp@-81#” $credential = New-Object System.Management.Automation.PSCredential($remoteUser, (ConvertTo-SecureString $remotePassword -AsPlainText -Force)) invoke-command -ComputerName $computerName -Credential $credential … Continue reading

Posted in develop, windows | Tagged , , | Leave a comment

Dot.Net and PowerShell

PS C:\Users\IBM_ADMIN> [IO.Path]::GetTempPath() C:\windows\TEMP\

Posted in develop | Tagged , | Leave a comment

Remove SQL Server components

From https://www.mssqltips.com/sqlservertip/4050/cleanly-uninstalling-stubborn-sql-server-components/ Prerequisite MSI Inventory tool, which you can download msiinv_new.zip You can get the GUID associated with each installed product by searching around the registry, but I would rather use the MSI Inventory tool, which you can download (msiinv_new.zip) … Continue reading

Posted in tools | Tagged , , , , | Leave a comment

Remotely setting network credentials using cmdkey

https://powershell.org/forums/topic/remotely-setting-network-credentials-using-cmdkey/ I have a task to automate the build on Azure VM with custom extension scripts. One of the tasks of the custom extension scripts is to map network drives [and save its credentials]. The custom extension scripts are automatically … Continue reading

Posted in develop | Tagged , , , , | Leave a comment

Update assemblyinfo.cs for a maintenance release

Function update_assemblyinfo_cs($path) { #[Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8 LogWrite “#####################################################” LogWrite “### Update the assemblyinfo.cs files              ###” LogWrite “#####################################################” $stanzaToFind = “BUILD_TSM_V” + $global:version + $global:release + $global:level $oldStanzaToFind = “BUILD_TSM_V” + $global:previousVersion + $global:previousRelease + $global:previousLevel Get-ChildItem $path -Recurse -Filter “assemblyinfo.cs” … Continue reading

Posted in develop | Tagged , , | Leave a comment

Microsoft SQL Server Powershell

https://www.mssqltips.com/sqlservertip/1759/retrieve-a-list-of-sql-server-databases-and-their-properties-using-powershell/ https://books.google.co.uk/books?id=SjnlCwAAQBAJ&pg=PA344&lpg=PA344&dq=sql+powershell+set+PrimaryFilePath&source=bl&ots=n8gFMa3Cq8&sig=wkCX6kKziGyEgBBPgvXFe9ZbSL0&hl=en&sa=X&ved=0ahUKEwjz2sfxjZvPAhXDZpoKHdDuDiAQ6AEIQDAF#v=onepage&q=sql%20powershell%20set%20PrimaryFilePath&f=false https://books.google.co.uk/books?id=SjnlCwAAQBAJ&printsec=frontcover http://sqlblog.com/blogs/allen_white/archive/2008/04/28/create-database-from-powershell.aspx To see the details on any error run: $error[0]|format-list -force

Posted in develop | Tagged , , , , | Leave a comment