Link to home
Start Free TrialLog in
Avatar of Edward Pamias
Edward PamiasFlag for United States of America

asked on

Powershell Script modification - I need this script to prompt for ID and password.

I found a  script that can disable IPV6 remotely but due to some rules I am not allowed to save my ID and password in a file. Can some one modify this powershell script to prompt me for ID and password?

$adminPwd = "PASSWORD"
$compName = "REMOTECOMPUTERNAME"
 
$secPwd = ConvertTo-SecureString $adminPwd -AsPlainText -Force
$remoteCreds = New-Object System.Management.Automation.PSCredential ($adminUser, $secPwd)
$ServerSession = New-PSSession -ComputerName $compName -Authentication CredSSP -Credential $remoteCreds
 
Invoke-Command -Session $ServerSession -ScriptBlock
{
      # Disable IPv6
      $regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters"
      New-ItemProperty -Path $regPath -Name "DisabledComponents" -Value "0xFFFFFFFF" -PropertyType "DWORD" | Out-Null
      Restart-Computer -ComputerName $env:computername -Force
}
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Edward Pamias

ASKER

Well the script runs but it does not work in this environment. I am going to close this out as the modification worked as I wanted. I need a script to disabled IPV6. I will post another question for that.
Thanks for the help.
Why are you disabling IPv6?
As per my comment above the 3rd level team told us to do it. I am not sure how this fixes our problem with Office 365 not seeing an  internet connection, but it does. And these is over VPN, when they are in the office its fine.
No comment above about Office.

I would not disable it and Microsoft directly advises against it. Can you please elaborate on the Office 365 not seeing an internet connection, if you want...
All depends on the user. One person could get activation screen another person could have a triangle on the top right next to their login and both users Office does not see the network. Any ideas?
One thing I forgot, this only happens at home while on VPN.
Shaun, I like the bottom link that is something we did not try. The top link never worked for me. I will reply back later in the week and let you know how it goes.