Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why wont this exit

Status
Not open for further replies.

GrimR

IS-IT--Management
Jun 17, 2007
1,149
ZA
Code:
#Get Windows Version
$version=(gwmi win32_operatingsystem).caption

write-host $version "is installed"
$win7='Microsoft Windows 7 Professional'
$Win10='Microsoft Windows 10 Pro'
if ($version -eq $Win7){
	exit
} else {
	
	#Add registry key for Windows 10 netwrok errorif
	write-host $Win10 'Installing'
	
$value =(Get-Itemproperty hklm:software\microsoft\windows\currentversion\policies\system).EnableLinkedConnections
 
If ($value -ne 0){
 Set-ItemProperty -Path hklm:software\microsoft\windows\currentversion\policies\system -Name EnableLinkedConnections -Value 1 
		}
}

MCSE NT to 2012, MCITP:EA/SA, MCSA, MCDBA, MCTS, MCP+I, MCP
 
thanks for all the help HAHAHA
fixed it

Code:
#Get Windows Version
$version=(Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, OSArchitecture, CSName)

		write-host $version.Caption "is installed"

if ($version.caption -like '*Windows 7*'){
		write-host $version.caption "Installed exiting"
	exit
} else {
	
	#Add registry key for Windows 10 netwrok errorif
		write-host $version.caption 'Installing key'
	
$value =(Get-Itemproperty hklm:software\microsoft\windows\currentversion\policies\system).EnableLinkedConnections
 
If ($value -ne 0){
 Set-ItemProperty -Path hklm:software\microsoft\windows\currentversion\policies\system -Name EnableLinkedConnections -Value 1 
		}
}

MCSE NT to 2012, MCITP:EA/SA, MCSA, MCDBA, MCTS, MCP+I, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top