Code Monkey home page Code Monkey logo

powershell_scripts's People

Contributors

chipitsine avatar it-praktyk avatar kensel avatar proxb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershell_scripts's Issues

Problems with ExtractAssociatedIcon

I made the script for a notification balloon that was gonna be in my Crazy Error, but there is a part of the script that is causing me problems (see image below, squared part is the script that causes me problems):
script

I try to run the script, and I get this (see image below):
stupid script not working

What is happening and how do i fix it?

Unable to find [System.Windows.Forms.ToolTipIcon] on windows7

I'm totally new in powershell, I add this:

Invoke-BalloonTip -Message 'This is a  message from my function' -Title 'Attention!' -MessageType  Info 

to the bottom of Invoke-BalloonTip.ps1:
image

Then I execute it:

PS C:\Users\bruce\Desktop> .\Invoke-BalloonTip.ps1

The error showed up:
image

strange behaviour in case of cluster

hello,

I'm running various instances of ms sql (including database engine, reporting, analysis, ...),

I was getting the following exception:

You cannot call a method on a null-valued expression.
At C:\xxx\Get-SQLInstance.ps1:185 char:25
+                         $PropertyHash['Version'] = $instanceRegSetup.GetValue('V ...
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

I added some debug: https://github.com/chipitsine/PowerShell_Scripts/blob/master/Get-SQLInstance.ps1#L182

here's more detailed exception

computer: SRV-SQL01-DCA
file: "C:\Program Files\Microsoft SQL Server\MSAS11.DEV_DCA\OLAP\bin\msmdsrv.exe" -s "H:\OLAP\Config"
service: "C:\Program Files\Microsoft SQL Server\MSAS11.DEV_DCA\OLAP\bin\msmdsrv.exe" -s "H:\OLAP\Config"
Something went wrong...
System.ArgumentException
Illegal characters in path.
You cannot call a method on a null-valued expression.
At C:\xxx\Get-SQLInstance.ps1:198 char:25
+                         $PropertyHash['Version'] = $instanceRegSetup.GetValue('V ...
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

it seems, script does not expect MSAS ?

Invoke-BalloonTip not working?

I'm pretty new to this stuff but I'm trying to get this one to run. I run it but no balloons appear. The script also is not failing. Is there anything that I should be modifying in the script?

Here is what I see:
image

I'd love any help. thanks!

How to get the sAMAccountName?

This is a very useful PS script so thank you greatly to the creator/contributors. It would just be even better if I could get the sAMAccountName out of it. Is this possible?

strange behaviour in case of multiple instances

Computername      : SRV-SQL02-DCA
Instance          : {MSSQL$DEV_DCA, MSSQL$HFM_DCA, MSSQL$INF_DCA, MSSQL$IPORT_DCA...}
SqlServer         : SRV-SQL-TFS
WMINamespace      : ComputerManagement12
Sqlstates         : 2099213
Version           : 12.0.2000.8
Splevel           : 0
Clustered         : True
Installpath       : C:\Program Files\Microsoft SQL Server\MSSQL12.WHD\MSSQL
Datapath          : S:\MSSQL12.WHD\MSSQL
Language          : 1033
Fileversion       : 2014.120.2000.8
Vsname            : SRV-SQLWHD-DCA
Regroot           : Software\Microsoft\Microsoft SQL Server\MSSQL12.WHD
Sku               : 1804890536
Skuname           : Enterprise Edition (64-bit)
Instanceid        : MSSQL12.WHD
Startupparameters : -dS:\MSSQL12.WHD\MSSQL\DATA\master.mdf;-eS:\MSSQL12.WHD\MSSQL\Log\ERRORLOG;-lS:\MSSQL12.WHD
                    \MSSQL\DATA\mastlog.ldf
Errorreporting    : False
Dumpdir           : S:\MSSQL12.WHD\MSSQL\LOG\
Sqmreporting      : False
Iswow64           : False
BackupDirectory   : S:\MSSQL12.WHD\MSSQL\Backup
AlwaysOnName      : 
Nodes             : {SRV-SQL01-DCA, SRV-SQL02-DCA, SRV-SQL03-DCB}
Caption           : SQL Server 2014
FullName          : SRV-SQL-TFS\System.Object[]

PowerShell 6 version of Set-Owner

Set-Owner does not work on PowerShell 6 due to referencing .NET Framework assembly APIs. .NET Core has refactored these APIs, and they no longer work in PowerShell 6 because the API is not there.

The following is a simpler Set-Owner script:

#
# IMPORTANT: Run with ELEVATION
#

# The target folder.
$folder = 'C:\Temp'

# Specify the new owner, which can be a mere username ('John.Doe'), a well-known
# security principal ('BUILTIN\Administrators'), or a UPN ('[email protected]')
$newOwner = 'BUILTIN\Administrators'

# Get the current ACL...
$acl = Get-Acl -LiteralPath $folder

# ... and assign the new owner...
$acl.SetOwner([System.Security.Principal.NTAccount] $newOwner)

# ... and set the modified ACL.
Set-Acl -LiteralPath $folder -AclObject $acl

"New owner: $((Get-Acl -LiteralPath $folder).Owner)"

Works Great! in ISE

When I run the script in ISE it works perfectly, but when I save it as a .PS1 I get:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Unable to find type [System.Windows.Forms.ToolTipIcon].
At C:\scripts\password\Password_Notify.ps1:37 char:9

  •     [System.Windows.Forms.ToolTipIcon]$MessageType="Info",
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Windows.Forms.ToolTipIcon:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

Set-ClientWSUSSetting have some minor issues

Hi Great work saved me some time ;-)
But it took me some time as AUOptions did never got higher than 3 in the registry.
Also got the message that automatic downloads are disabled.. (w10 21H1)
Looks like NoAutoUpdate needs to be reversed..
here I have some enhancements for that issue's

The following " } ElseIf ($Options = " should be " } ElseIf ($Options -eq"
That way "AUOptions" can get higher than 3 ;-)
Line 223,225 and 227
If ($PSBoundParameters['Options']) {
If ($pscmdlet.ShouldProcess("Options","Set Value")) {
If ($Options -eq 'Notify') {
$WsusConfig.SetValue('AUOptions',2,[Microsoft.Win32.RegistryValueKind]::DWord)
} ElseIf ($Options = 'DownloadOnly') {
$WsusConfig.SetValue('AUOptions',3,[Microsoft.Win32.RegistryValueKind]::DWord)
} ElseIf ($Options = 'DownloadAndInstall') {
$WsusConfig.SetValue('AUOptions',4,[Microsoft.Win32.RegistryValueKind]::DWord)
} ElseIf ($Options = 'AllowUserConfig') {
$WsusConfig.SetValue('AUOptions',5,[Microsoft.Win32.RegistryValueKind]::DWord)
}
}
}

Then there is an mistake at: AllowAutomaticUpdates starting from line 310.

When Enabled it enables NoAutoUpdate to 1, when I do this at Windows10 21H1 it says automatic updates disabled.
changing it to 0, NoAutoUpdate to 0 and that message Disappears .
So I changed 313 and 317 1to0 and 0to1.

Hope it helps someone else.
Anyway keep up the good work!.
Arnold.

how to determine cluster node ?

hello,

I've writter simple script

cls

. "C:\xxx\Get-SQLInstance.ps1"

'running on: {0}' -f  $env:Computername
'---------------'

Get-SQLInstance -Computername $env:Computername | % {
    $_.ComputerName
}

I expected it to show cluster node (an owner of cluster application). However, it shows current computer all the time:

running on: SRV-SQL01-DCA
---------------
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA

PS C:\Windows\system32> 

actually, I checked, cluster instances are distributed across several nodes.

Get-LocalGroupMembership.ps1 : Alternate Credentials?

I work in a DevOps heavy environment where there are a lot of machines that do not get joined into the Domain because they are torn down after their smoke-tests are run. Or that's what they tell me is supposed to happen...

In reality though a good number of these machines persist and get passed around from dev to dev. That creates an issue of needing non-domain credentials to pull ADSI information from the remote host.

How could we facilitate that use case with the script? Would it need to be a new fork entirely or could it be added in?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.